You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/02/07 11:38:13 UTC
svn commit: r1443392 - in /openoffice/branches/sidebar/main:
svx/inc/svx/galbrws.hxx svx/source/gallery2/galbrws.cxx
vcl/inc/vcl/split.hxx vcl/source/window/split.cxx
Author: alg
Date: Thu Feb 7 10:38:13 2013
New Revision: 1443392
URL: http://svn.apache.org/viewvc?rev=1443392&view=rev
Log:
i121420: Gallery now able to relayout automatically
Modified:
openoffice/branches/sidebar/main/svx/inc/svx/galbrws.hxx
openoffice/branches/sidebar/main/svx/source/gallery2/galbrws.cxx
openoffice/branches/sidebar/main/vcl/inc/vcl/split.hxx
openoffice/branches/sidebar/main/vcl/source/window/split.cxx
Modified: openoffice/branches/sidebar/main/svx/inc/svx/galbrws.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/inc/svx/galbrws.hxx?rev=1443392&r1=1443391&r2=1443392&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/inc/svx/galbrws.hxx (original)
+++ openoffice/branches/sidebar/main/svx/inc/svx/galbrws.hxx Thu Feb 7 10:38:13 2013
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
#ifndef _SVX_GALBRWS_HXX_
#define _SVX_GALBRWS_HXX_
@@ -72,19 +70,16 @@ class GalleryBrowser : public SfxDocking
using Window::KeyInput;
private:
-
Size maLastSize;
GallerySplitter* mpSplitter;
GalleryBrowser1* mpBrowser1;
GalleryBrowser2* mpBrowser2;
Gallery* mpGallery;
- long mnDummy1;
- long mnDummy2;
- long mnDummy3;
+ /// bitfield
void InitSettings();
- virtual sal_Bool Close();
+ virtual sal_Bool Close();
virtual void Resize();
virtual void GetFocus();
Modified: openoffice/branches/sidebar/main/svx/source/gallery2/galbrws.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/gallery2/galbrws.cxx?rev=1443392&r1=1443391&r2=1443392&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/gallery2/galbrws.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/gallery2/galbrws.cxx Thu Feb 7 10:38:13 2013
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
@@ -55,18 +53,16 @@ public:
// -----------------------------------------------------------------------------
DBG_NAME(GallerySplitter)
-GallerySplitter::GallerySplitter( Window* pParent, const ResId& rResId ) :
- Splitter( pParent, rResId )
+GallerySplitter::GallerySplitter( Window* pParent, const ResId& rResId )
+: Splitter( pParent, rResId )
{
DBG_CTOR(GallerySplitter,NULL);
-
}
// -----------------------------------------------------------------------------
GallerySplitter::~GallerySplitter()
{
-
DBG_DTOR(GallerySplitter,NULL);
}
@@ -110,9 +106,17 @@ SFX_IMPL_DOCKINGWINDOW( GalleryChildWind
// ------------------
DBG_NAME(GalleryBrowser)
-GalleryBrowser::GalleryBrowser( SfxBindings* _pBindings, SfxChildWindow* pCW,
- Window* pParent, const ResId& rResId ) :
- SfxDockingWindow( _pBindings, pCW, pParent, rResId )
+GalleryBrowser::GalleryBrowser(
+ SfxBindings* _pBindings,
+ SfxChildWindow* pCW,
+ Window* pParent,
+ const ResId& rResId)
+: SfxDockingWindow(_pBindings, pCW, pParent, rResId),
+ maLastSize(GetOutputSizePixel()),
+ mpSplitter(0),
+ mpBrowser1(0),
+ mpBrowser2(0),
+ mpGallery(0)
{
DBG_CTOR(GalleryBrowser,NULL);
@@ -122,12 +126,14 @@ GalleryBrowser::GalleryBrowser( SfxBindi
mpBrowser2 = new GalleryBrowser2( this, GAL_RESID( GALLERY_BROWSER2 ), mpGallery );
FreeResource();
- SetMinOutputSizePixel( maLastSize = GetOutputSizePixel() );
+ SetMinOutputSizePixel(maLastSize);
mpBrowser1->SelectTheme( 0 );
mpBrowser1->Show( sal_True );
mpBrowser2->Show( sal_True );
+ const bool bLayoutHorizontal(maLastSize.Width() > maLastSize.Height());
+ mpSplitter->SetHorizontal(bLayoutHorizontal);
mpSplitter->SetSplitHdl( LINK( this, GalleryBrowser, SplitHdl ) );
mpSplitter->Show( sal_True );
@@ -170,25 +176,64 @@ void GalleryBrowser::InitSettings()
void GalleryBrowser::Resize()
{
- SfxDockingWindow::Resize();
+ // call parent
+ SfxDockingWindow::Resize();
- const long nFrameWidth = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
- const long nFrameWidth2 = nFrameWidth << 1;
- Size aMinSize( GetMinOutputSizePixel() );
- Size aNewSize( GetOutputSizePixel() );
- Point aSplitPos( mpSplitter->GetPosPixel() );
- const Size aSplitSize( mpSplitter->GetOutputSizePixel() );
+ // update hor/ver
+ const Size aNewSize( GetOutputSizePixel() );
+ const bool bNewLayoutHorizontal(aNewSize.Width() > aNewSize.Height());
+ const bool bOldLayoutHorizontal(mpSplitter->IsHorizontal());
+ const long nSplitPos( bOldLayoutHorizontal ? mpSplitter->GetPosPixel().X() : mpSplitter->GetPosPixel().Y());
+ const long nSplitSize( bOldLayoutHorizontal ? mpSplitter->GetOutputSizePixel().Width() : mpSplitter->GetOutputSizePixel().Height());
- mpBrowser1->SetPosSizePixel( Point( nFrameWidth, nFrameWidth ),
- Size( aSplitPos.X() - nFrameWidth, aNewSize.Height() - nFrameWidth2 ) );
+ if(bNewLayoutHorizontal != bOldLayoutHorizontal)
+ {
+ mpSplitter->SetHorizontal(bNewLayoutHorizontal);
+ }
- mpSplitter->SetPosSizePixel( aSplitPos, Size( aSplitSize.Width(), aNewSize.Height() ) );
- mpSplitter->SetDragRectPixel( Rectangle( Point( nFrameWidth2, 0 ), Size( aNewSize.Width() - ( nFrameWidth2 << 1 ) - aSplitSize.Width(), aNewSize.Height() ) ) );
+ const long nFrameLen = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
+ const long nFrameLen2 = nFrameLen << 1;
- mpBrowser2->SetPosSizePixel( Point( aSplitPos.X() + aSplitSize.Width(), nFrameWidth ),
- Size( aNewSize.Width() - aSplitSize.Width() - aSplitPos.X() - nFrameWidth, aNewSize.Height() - nFrameWidth2 ) );
+ if(bNewLayoutHorizontal)
+ {
+ mpBrowser1->SetPosSizePixel(
+ Point( nFrameLen, nFrameLen ),
+ Size(nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2) );
+
+ mpSplitter->SetPosSizePixel(
+ Point( nSplitPos, 0),
+ Size( nSplitSize, aNewSize.Height() ) );
+
+ mpSplitter->SetDragRectPixel(
+ Rectangle(
+ Point( nFrameLen2, 0 ),
+ Size( aNewSize.Width() - ( nFrameLen2 << 1 ) - nSplitSize, aNewSize.Height() ) ) );
+
+ mpBrowser2->SetPosSizePixel(
+ Point( nSplitPos + nSplitSize, nFrameLen ),
+ Size( aNewSize.Width() - nSplitSize - nSplitPos - nFrameLen, aNewSize.Height() - nFrameLen2 ) );
+ }
+ else
+ {
+ mpBrowser1->SetPosSizePixel(
+ Point( nFrameLen, nFrameLen ),
+ Size(aNewSize.Width() - nFrameLen2, nSplitPos - nFrameLen));
+
+ mpSplitter->SetPosSizePixel(
+ Point( 0, nSplitPos),
+ Size( aNewSize.Width(), nSplitSize ) );
+
+ mpSplitter->SetDragRectPixel(
+ Rectangle(
+ Point( 0, nFrameLen2 ),
+ Size( aNewSize.Width(), aNewSize.Height() - ( nFrameLen2 << 1 ) - nSplitSize ) ));
+
+ mpBrowser2->SetPosSizePixel(
+ Point( nFrameLen, nSplitPos + nSplitSize ),
+ Size( aNewSize.Width() - nFrameLen2, aNewSize.Height() - nSplitSize - nSplitPos - nFrameLen ));
+ }
- maLastSize = aNewSize;
+ maLastSize = aNewSize;
}
// -----------------------------------------------------------------------------
@@ -289,8 +334,19 @@ sal_Bool GalleryBrowser::IsLinkage() con
IMPL_LINK( GalleryBrowser, SplitHdl, void*, EMPTYARG )
{
- mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) );
- Resize();
+ if(mpSplitter->IsHorizontal())
+ {
+ mpSplitter->SetPosPixel( Point( mpSplitter->GetSplitPosPixel(), mpSplitter->GetPosPixel().Y() ) );
+ }
+ else
+ {
+ mpSplitter->SetPosPixel( Point( mpSplitter->GetPosPixel().X(), mpSplitter->GetSplitPosPixel() ) );
+ }
+
+ Resize();
return 0L;
}
+
+// -----------------------------------------------------------------------------
+// eof
Modified: openoffice/branches/sidebar/main/vcl/inc/vcl/split.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/vcl/inc/vcl/split.hxx?rev=1443392&r1=1443391&r2=1443392&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/vcl/inc/vcl/split.hxx (original)
+++ openoffice/branches/sidebar/main/vcl/inc/vcl/split.hxx Thu Feb 7 10:38:13 2013
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
#ifndef _SV_SPLIT_HXX
#define _SV_SPLIT_HXX
@@ -60,6 +58,7 @@ private:
SAL_DLLPRIVATE sal_Bool ImplSplitterActive();
SAL_DLLPRIVATE Splitter* ImplFindSibling();
SAL_DLLPRIVATE void ImplRestoreSplitter();
+ SAL_DLLPRIVATE void ImplInitHorVer(bool bNew);
// Copy assignment is forbidden and not implemented.
SAL_DLLPRIVATE Splitter (const Splitter &);
@@ -104,7 +103,8 @@ public:
void SetLastSplitPosPixel( long nNewPos );
long GetLastSplitPosPixel() const { return mnLastSplitPos; }
- sal_Bool IsHorizontal() const { return mbHorzSplit; }
+ sal_Bool IsHorizontal() const { return mbHorzSplit; }
+ void SetHorizontal(bool bNew);
// set the stepsize of the splitter for cursor movement
// the default is 10% of the reference window's width/height
Modified: openoffice/branches/sidebar/main/vcl/source/window/split.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/vcl/source/window/split.cxx?rev=1443392&r1=1443391&r2=1443392&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/vcl/source/window/split.cxx (original)
+++ openoffice/branches/sidebar/main/vcl/source/window/split.cxx Thu Feb 7 10:38:13 2013
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
@@ -72,32 +70,39 @@ void Splitter::ImplInitSplitterData()
// -----------------------------------------------------------------------
-void Splitter::ImplInit( Window* pParent, WinBits nWinStyle )
+void Splitter::ImplInitHorVer(bool bNew)
{
- Window::ImplInit( pParent, nWinStyle, NULL );
+ if(bNew != (bool)mbHorzSplit)
+ {
+ mbHorzSplit = bNew;
- mpRefWin = pParent;
+ PointerStyle ePointerStyle;
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
- const StyleSettings& rSettings = GetSettings().GetStyleSettings();
- long nA = rSettings.GetScrollBarSize();
- long nB = rSettings.GetSplitSize();
+ if ( mbHorzSplit )
+ {
+ ePointerStyle = POINTER_HSPLIT;
+ SetSizePixel( Size( rSettings.GetSplitSize(), rSettings.GetScrollBarSize() ) );
+ }
+ else
+ {
+ ePointerStyle = POINTER_VSPLIT;
+ SetSizePixel( Size( rSettings.GetScrollBarSize(), rSettings.GetSplitSize() ) );
+ }
- PointerStyle ePointerStyle;
+ SetPointer( Pointer( ePointerStyle ) );
+ }
+}
- if ( nWinStyle & WB_HSCROLL )
- {
- ePointerStyle = POINTER_HSPLIT;
- mbHorzSplit = sal_True;
- SetSizePixel( Size( nB, nA ) );
- }
- else
- {
- ePointerStyle = POINTER_VSPLIT;
- mbHorzSplit = sal_False;
- SetSizePixel( Size( nA, nB ) );
- }
+// -----------------------------------------------------------------------
+
+void Splitter::ImplInit( Window* pParent, WinBits nWinStyle )
+{
+ Window::ImplInit( pParent, nWinStyle, NULL );
+
+ mpRefWin = pParent;
- SetPointer( Pointer( ePointerStyle ) );
+ ImplInitHorVer(nWinStyle & WB_HSCROLL);
if( GetSettings().GetStyleSettings().GetFaceColor().IsDark() )
SetBackground( ImplWhiteWall::get() );
@@ -182,6 +187,16 @@ Splitter::~Splitter()
// -----------------------------------------------------------------------
+void Splitter::SetHorizontal(bool bNew)
+{
+ if(bNew != (bool)mbHorzSplit)
+ {
+ ImplInitHorVer(bNew);
+ }
+}
+
+// -----------------------------------------------------------------------
+
void Splitter::SetKeyboardStepSize( long nStepSize )
{
mnKeyboardStepSize = nStepSize;