[Libreoffice-commits] .: 4 commits - jvmfwk/source vcl/inc vcl/Library_vcl.mk vcl/Package_inc.mk vcl/source vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Oct 9 13:33:56 PDT 2012
jvmfwk/source/elements.cxx | 3
jvmfwk/source/fwkbase.cxx | 1
vcl/Library_vcl.mk | 2
vcl/Package_inc.mk | 1
vcl/inc/vcl/arrange.hxx | 385 -----------------
vcl/inc/vcl/window.hxx | 29 -
vcl/inc/window.h | 2
vcl/source/control/fixed.cxx | 3
vcl/source/window/arrange.cxx | 772 -----------------------------------
vcl/source/window/window.cxx | 5
vcl/source/window/window2.cxx | 1
vcl/source/window/window4.cxx | 166 -------
vcl/unx/kde/salnativewidgets-kde.cxx | 391 ++++++++---------
13 files changed, 196 insertions(+), 1565 deletions(-)
New commits:
commit f2b34cb356bf858eb5108fe76e3595597179a88f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 9 20:13:23 2012 +0100
merge double fix
Change-Id: Id213a881bbb56fbd6a8e16e8a40ce1dc3e57cab7
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 9409fe6..254494c 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -470,10 +470,7 @@ void FixedText::setMaxWidthChars(sal_Int32 nWidth)
bool FixedText::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
{
if (rKey == "max-width-chars")
- {
setMaxWidthChars(rValue.toInt32());
- return true;
- }
else
return Control::set_property(rKey, rValue);
return true;
commit d00dc669964bb407a49420ecddf0647a5276c3f6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 9 20:09:46 2012 +0100
loplugin: unused OStrings
Change-Id: I22916424fb97ba27ea6f4e540841a6c851fb8c88
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 17d1f27..a395717 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -909,9 +909,6 @@ void CNodeJavaInfo::writeToNode(xmlDoc* pDoc,
{
OSL_ASSERT(pJavaInfoNode && pDoc);
- rtl::OString sExcMsg("[Java framework] Error in function NodeJavaInfo::writeToNode "
- "(elements.cxx).");
-
//write the attribute vendorSettings
//javaInfo at vendorUpdate
diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx
index c03e27f..a251401 100644
--- a/jvmfwk/source/fwkbase.cxx
+++ b/jvmfwk/source/fwkbase.cxx
@@ -294,7 +294,6 @@ OUString VendorSettings::getPluginLibrary(const OUString& sVendor)
OSL_ASSERT(!sVendor.isEmpty());
OString sExcMsg("[Java framework] Error in function getPluginLibrary (fwkbase.cxx).");
- OString sVendorsPath = getVendorSettingsPath(m_xmlDocVendorSettingsFileUrl);
OUStringBuffer usBuffer(256);
usBuffer.appendAscii("/jf:javaSelection/jf:plugins/jf:library[@vendor=\"");
usBuffer.append(sVendor);
commit 453abd0e1b2c2e692f1662b3327ed5a78510bb9a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 9 20:07:22 2012 +0100
kill off the layout competition
Change-Id: I00882045bb7c23a6ad88013b651c9151e836965d
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 6aaa675..d1dbad6 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -242,7 +242,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/window/abstdlg \
vcl/source/window/accel \
vcl/source/window/accmgr \
- vcl/source/window/arrange \
vcl/source/window/brdwin \
vcl/source/window/btndlg \
vcl/source/window/builder \
@@ -282,7 +281,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/window/toolbox \
vcl/source/window/window2 \
vcl/source/window/window3 \
- vcl/source/window/window4 \
vcl/source/window/window \
vcl/source/window/winproc \
vcl/source/window/wrkwin \
diff --git a/vcl/Package_inc.mk b/vcl/Package_inc.mk
index c9868e3..fa831c5 100644
--- a/vcl/Package_inc.mk
+++ b/vcl/Package_inc.mk
@@ -32,7 +32,6 @@ $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/accel.hxx,vcl/accel.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/alpha.hxx,vcl/alpha.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/animate.hxx,vcl/animate.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/apptypes.hxx,vcl/apptypes.hxx))
-$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/arrange.hxx,vcl/arrange.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/bitmapex.hxx,vcl/bitmapex.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/bitmap.hxx,vcl/bitmap.hxx))
$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/bmpacc.hxx,vcl/bmpacc.hxx))
diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx
deleted file mode 100644
index 5d99723..0000000
--- a/vcl/inc/vcl/arrange.hxx
+++ /dev/null
@@ -1,385 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _VCL_ARRANGE_HXX
-#define _VCL_ARRANGE_HXX
-
-#include "vcl/window.hxx"
-
-#include <vector>
-#include <map>
-#include <boost/shared_ptr.hpp>
-
-namespace vcl
-{
- /* some helper classes for simple window layouting
- guidelines:
- - a WindowArranger is not a Window
- - a WindowArranger hierarchy manages exactly one level of child windows inside a common parent
- this is to keep the vcl Window hierarchy flat, as some code like accelerators depend on such behavior
- - a WindowArranger never becomes owner of a Window, windows need to be destroyed separately
- - a WindowArranger however always is owner of its child WindowArrangers, that is the
- WindowArranger hierarchy will keep track of its objects and delete them
- - a managed element of a WindowArranger can either be a Window (a leaf in the hierarchy)
- or a child WindowArranger (a node in the hierarchy), but never both
- */
-
- class VCL_DLLPUBLIC WindowArranger
- {
- protected:
- struct Element
- {
- Window* m_pElement;
- boost::shared_ptr<WindowArranger> m_pChild;
- sal_Int32 m_nExpandPriority;
- Size m_aMinSize;
- bool m_bHidden;
- long m_nLeftBorder;
- long m_nTopBorder;
- long m_nRightBorder;
- long m_nBottomBorder;
-
- Element()
- : m_pElement( NULL )
- , m_pChild()
- , m_nExpandPriority( 0 )
- , m_bHidden( false )
- , m_nLeftBorder( 0 )
- , m_nTopBorder( 0 )
- , m_nRightBorder( 0 )
- , m_nBottomBorder( 0 )
- {}
-
- Element( Window* i_pWin,
- boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(),
- sal_Int32 i_nExpandPriority = 0,
- const Size& i_rMinSize = Size()
- )
- : m_pElement( i_pWin )
- , m_pChild( i_pChild )
- , m_nExpandPriority( i_nExpandPriority )
- , m_aMinSize( i_rMinSize )
- , m_bHidden( false )
- , m_nLeftBorder( 0 )
- , m_nTopBorder( 0 )
- , m_nRightBorder( 0 )
- , m_nBottomBorder( 0 )
- {}
-
- void deleteChild() { m_pChild.reset(); }
-
- sal_Int32 getExpandPriority() const;
- Size getOptimalSize( WindowSizeType ) const;
- bool isVisible() const;
- void setPosSize( const Point&, const Size& );
- };
-
- Window* m_pParentWindow;
- WindowArranger* m_pParentArranger;
- Rectangle m_aManagedArea;
- long m_nOuterBorder;
-
- rtl::OUString m_aIdentifier;
-
- virtual Element* getElement( size_t i_nIndex ) = 0;
- const Element* getConstElement( size_t i_nIndex ) const
- { return const_cast<WindowArranger*>(this)->getElement( i_nIndex ); }
-
-
- public:
- static long getDefaultBorder();
-
- static long getBorderValue( long nBorder )
- { return nBorder >= 0 ? nBorder : -nBorder * getDefaultBorder(); }
-
- WindowArranger( WindowArranger* i_pParent = NULL )
- : m_pParentWindow( i_pParent ? i_pParent->m_pParentWindow : NULL )
- , m_pParentArranger( i_pParent )
- , m_nOuterBorder( 0 )
- {}
- virtual ~WindowArranger();
-
- // ask what would be the optimal size
- virtual Size getOptimalSize( WindowSizeType ) const = 0;
- // call Resize to trigger layouting inside the managed area
- // without function while parent window is unset
- virtual void resize() = 0;
- // avoid this if possible, using the constructor instead
- // there can be only one parent window and all managed windows MUST
- // be direct children of that window
- // violating that condition will result in undefined behavior
- virtual void setParentWindow( Window* );
-
- virtual void setParent( WindowArranger* );
-
- virtual size_t countElements() const = 0;
- boost::shared_ptr<WindowArranger> getChild( size_t i_nIndex ) const
- {
- const Element* pEle = getConstElement( i_nIndex );
- return pEle ? pEle->m_pChild : boost::shared_ptr<WindowArranger>();
- }
- Window* getWindow( size_t i_nIndex ) const
- {
- const Element* pEle = getConstElement( i_nIndex );
- return pEle ? pEle->m_pElement : NULL;
- }
-
- virtual bool isVisible() const; // true if any element is visible
-
- virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getProperties() const;
- virtual void setProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& );
-
- sal_Int32 getExpandPriority( size_t i_nIndex ) const
- {
- const Element* pEle = getConstElement( i_nIndex );
- return pEle ? pEle->getExpandPriority() : 0;
- }
-
- Size getMinimumSize( size_t i_nIndex ) const
- {
- const Element* pEle = getConstElement( i_nIndex );
- return pEle ? pEle->m_aMinSize : Size();
- }
-
- bool setMinimumSize( size_t i_nIndex, const Size& i_rMinSize )
- {
- Element* pEle = getElement( i_nIndex );
- if( pEle )
- pEle->m_aMinSize = i_rMinSize;
- return pEle != NULL;
- }
-
- void setBorders( size_t i_nIndex, long i_nLeft, long i_nTop, long i_nRight, long i_nBottom )
- {
- Element* pEle = getElement( i_nIndex );
- if( pEle )
- {
- pEle->m_nLeftBorder = i_nLeft;
- pEle->m_nRightBorder = i_nRight;
- pEle->m_nTopBorder = i_nTop;
- pEle->m_nBottomBorder = i_nBottom;
- }
- }
-
- void getBorders( size_t i_nIndex, long* i_pLeft = NULL, long* i_pTop = NULL, long* i_pRight = NULL, long* i_pBottom = NULL ) const
- {
- const Element* pEle = getConstElement( i_nIndex );
- if( pEle )
- {
- if( i_pLeft ) *i_pLeft = pEle->m_nLeftBorder;
- if( i_pTop ) *i_pTop = pEle->m_nTopBorder;
- if( i_pRight ) *i_pRight = pEle->m_nRightBorder;
- if( i_pBottom ) *i_pBottom = pEle->m_nBottomBorder;
- }
- }
-
-
- void show( bool i_bShow = true, bool i_bImmediateUpdate = true );
-
- void setManagedArea( const Rectangle& i_rArea )
- {
- m_aManagedArea = i_rArea;
- resize();
- }
- const Rectangle& getManagedArea() const { return m_aManagedArea; }
-
- void setOuterBorder( long i_nBorder )
- {
- m_nOuterBorder = i_nBorder;
- resize();
- }
-
- const rtl::OUString getIdentifier() const
- { return m_aIdentifier; }
-
- void setIdentifier( const rtl::OUString& i_rId )
- { m_aIdentifier = i_rId; }
- };
-
- class VCL_DLLPUBLIC RowOrColumn : public WindowArranger
- {
- long m_nBorderWidth;
- bool m_bColumn;
-
- std::vector< WindowArranger::Element > m_aElements;
-
- void distributeRowWidth( std::vector< Size >& io_rSizes, long i_nUsedWidth, long i_nExtraWidth );
- void distributeColumnHeight( std::vector< Size >& io_rSizes, long i_nUsedHeight, long i_nExtraHeight );
- protected:
- virtual Element* getElement( size_t i_nIndex )
- { return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; }
-
- public:
- RowOrColumn( WindowArranger* i_pParent = NULL,
- bool bColumn = true, long i_nBorderWidth = -1 )
- : WindowArranger( i_pParent )
- , m_nBorderWidth( i_nBorderWidth )
- , m_bColumn( bColumn )
- {}
-
- virtual ~RowOrColumn();
-
- virtual Size getOptimalSize( WindowSizeType ) const;
- virtual void resize();
- virtual size_t countElements() const { return m_aElements.size(); }
-
- // add a managed window at the given index
- // an index smaller than zero means add the window at the end
- size_t addWindow( Window*, sal_Int32 i_nExpandPrio = 0, const Size& i_rMinSize = Size(), size_t i_nIndex = ~0 );
-
- size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 );
- // convenience: use for addChild( new WindowArranger( ... ) ) constructs
- size_t addChild( WindowArranger* i_pNewChild, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 )
- { return addChild( boost::shared_ptr<WindowArranger>( i_pNewChild ), i_nExpandPrio, i_nIndex ); }
-
- long getBorderWidth() const { return m_nBorderWidth; }
- };
-
- class VCL_DLLPUBLIC LabeledElement : public WindowArranger
- {
- WindowArranger::Element m_aLabel;
- WindowArranger::Element m_aElement;
- long m_nDistance;
- long m_nLabelColumnWidth;
- int m_nLabelStyle;
- protected:
- virtual Element* getElement( size_t i_nIndex )
- {
- if( i_nIndex == 0 )
- return &m_aLabel;
- else if( i_nIndex == 1 )
- return &m_aElement;
- return 0;
- }
-
- public:
- LabeledElement( WindowArranger* i_pParent = NULL, int i_nLabelStyle = 0, long i_nDistance = -1 )
- : WindowArranger( i_pParent )
- , m_nDistance( i_nDistance )
- , m_nLabelColumnWidth( 0 )
- , m_nLabelStyle( i_nLabelStyle )
- {}
-
- virtual ~LabeledElement();
-
- virtual Size getOptimalSize( WindowSizeType ) const;
- virtual void resize();
- virtual size_t countElements() const { return 2; }
-
- void setLabel( Window* );
- void setElement( Window* );
- void setElement( boost::shared_ptr<WindowArranger> const & );
- void setLabelColumnWidth( long i_nWidth )
- { m_nLabelColumnWidth = i_nWidth; }
-
- Size getLabelSize( WindowSizeType i_eType ) const
- { return m_aLabel.getOptimalSize( i_eType ); }
- Size getElementSize( WindowSizeType i_eType ) const
- { return m_aElement.getOptimalSize( i_eType ); }
- };
-
- class VCL_DLLPUBLIC LabelColumn : public RowOrColumn
- {
- long getLabelWidth() const;
- public:
- LabelColumn( WindowArranger* i_pParent = NULL, long i_nBorderWidth = -1 )
- : RowOrColumn( i_pParent, true, i_nBorderWidth )
- {}
- virtual ~LabelColumn();
-
- virtual Size getOptimalSize( WindowSizeType ) const;
- virtual void resize();
-
- // returns the index of the added label
- size_t addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger> const& i_rElement, long i_nIndent = 0 );
- };
-
- class VCL_DLLPUBLIC Indenter : public WindowArranger
- {
- long m_nIndent;
- WindowArranger::Element m_aElement;
-
- protected:
- virtual Element* getElement( size_t i_nIndex )
- { return i_nIndex == 0 ? &m_aElement : NULL; }
-
- public:
- Indenter( WindowArranger* i_pParent = NULL, long i_nIndent = 3*getDefaultBorder() )
- : WindowArranger( i_pParent )
- , m_nIndent( i_nIndent )
- {}
-
- virtual ~Indenter();
-
- virtual Size getOptimalSize( WindowSizeType ) const;
- virtual void resize();
- virtual size_t countElements() const { return (m_aElement.m_pElement != 0 || m_aElement.m_pChild != 0) ? 1 : 0; }
-
- void setIndent( long i_nIndent )
- {
- m_nIndent = i_nIndent;
- resize();
- }
-
- void setChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0 );
- // convenience: use for setChild( new WindowArranger( ... ) ) constructs
- void setChild( WindowArranger* i_pChild, sal_Int32 i_nExpandPrio = 0 )
- { setChild( boost::shared_ptr<WindowArranger>( i_pChild ), i_nExpandPrio ); }
- };
-
- class VCL_DLLPUBLIC Spacer : public WindowArranger
- {
- WindowArranger::Element m_aElement;
- Size m_aSize;
-
- protected:
- virtual Element* getElement( size_t i_nIndex )
- { return i_nIndex == 0 ? &m_aElement : NULL; }
-
- public:
- Spacer( WindowArranger* i_pParent = NULL, sal_Int32 i_nPrio = 20, const Size& i_rSize = Size( 0, 0 ) )
- : WindowArranger( i_pParent )
- , m_aElement( NULL, boost::shared_ptr<WindowArranger>(), i_nPrio )
- , m_aSize( i_rSize )
- {}
-
- virtual ~Spacer() {}
-
- virtual Size getOptimalSize( WindowSizeType ) const
- { return m_aSize; }
- virtual void resize() {}
- virtual void setParentWindow( Window* ) {}
- virtual size_t countElements() const { return 1; }
- virtual bool isVisible() const { return true; }
- };
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index a70ff66..80ce5fd 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -126,7 +126,6 @@ namespace dnd {
namespace vcl {
struct ControlLayoutData;
- struct ExtWindowImpl;
}
namespace svt { class PopupWindowControllerImpl; }
@@ -483,10 +482,7 @@ public:
SAL_DLLPRIVATE sal_Bool ImplUpdatePos();
SAL_DLLPRIVATE void ImplUpdateSysObjPos();
SAL_DLLPRIVATE WindowImpl* ImplGetWindowImpl() const { return mpWindowImpl; }
- SAL_DLLPRIVATE void ImplFreeExtWindowImpl();
- // creates ExtWindowImpl on demand, but may return NULL (e.g. if mbInDtor)
- SAL_DLLPRIVATE vcl::ExtWindowImpl* ImplGetExtWindowImpl() const;
- SAL_DLLPRIVATE void ImplDeleteOwnedChildren();
+
/** check whether a font is suitable for UI
The font to be tested will be checked whether it could display a
@@ -549,7 +545,6 @@ public:
SAL_DLLPRIVATE sal_Bool ImplRegisterAccessibleNativeFrame();
SAL_DLLPRIVATE void ImplRevokeAccessibleNativeFrame();
SAL_DLLPRIVATE void ImplCallResize();
- SAL_DLLPRIVATE void ImplExtResize();
SAL_DLLPRIVATE void ImplCallMove();
SAL_DLLPRIVATE Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle& rRect ) const;
SAL_DLLPRIVATE void ImplMirrorFramePos( Point &pt ) const;
@@ -1309,28 +1304,6 @@ public:
virtual rtl::OUString GetSurroundingText() const;
virtual Selection GetSurroundingTextSelection() const;
-
- // ExtImpl
-
- // old layouting, in-process-of-removal
-
- /* return the identifier of this window
- */
- const rtl::OUString& getIdentifier() const;
-
- /* returns the first found descendant that matches
- the passed identifier or NULL
- */
- Window* findWindow( const rtl::OUString& ) const;
-
- /* get/set properties
- this will contain window properties (like visible, enabled)
- as well as properties of derived classes (e.g. text of Edit fields)
- */
- virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getProperties() const;
- /*
- */
- virtual void setProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& );
};
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index dd7718b..cb48d04 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -101,7 +101,6 @@ namespace dnd {
namespace vcl {
struct ControlLayoutData;
- struct ExtWindowImpl;
}
@@ -269,7 +268,6 @@ public:
ImplDelData* mpFirstDel;
void* mpUserData;
- vcl::ExtWindowImpl* mpExtImpl;
Cursor* mpCursor;
Pointer maPointer;
Fraction maZoom;
diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx
deleted file mode 100644
index d7f79a0..0000000
--- a/vcl/source/window/arrange.cxx
+++ /dev/null
@@ -1,772 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "svdata.hxx"
-
-#include "vcl/arrange.hxx"
-#include "vcl/edit.hxx"
-#include "vcl/svapp.hxx"
-
-#include "com/sun/star/beans/PropertyValue.hpp"
-#include "com/sun/star/awt/Rectangle.hpp"
-
-#include "osl/diagnose.h"
-
-using namespace vcl;
-using namespace com::sun::star;
-
-// ----------------------------------------
-// vcl::WindowArranger
-//-----------------------------------------
-
-long WindowArranger::getDefaultBorder()
-{
- ImplSVData* pSVData = ImplGetSVData();
- long nResult = pSVData->maAppData.mnDefaultLayoutBorder;
- if( nResult < 0 )
- {
- OutputDevice* pDefDev = Application::GetDefaultDevice();
- if( pDefDev )
- {
- Size aBorder( pDefDev->LogicToPixel( Size( 3, 3 ), MapMode( MAP_APPFONT ) ) );
- nResult = pSVData->maAppData.mnDefaultLayoutBorder = aBorder.Height();
- }
- }
- return nResult > 0 ? nResult : 0;
-}
-
-WindowArranger::~WindowArranger()
-{}
-
-void WindowArranger::setParent( WindowArranger* i_pParent )
-{
- OSL_VERIFY( i_pParent->m_pParentWindow == m_pParentWindow || m_pParentWindow == NULL );
-
- m_pParentArranger = i_pParent;
- m_pParentWindow = i_pParent->m_pParentWindow;
- setParentWindow( m_pParentWindow );
-}
-
-void WindowArranger::setParentWindow( Window* i_pNewParent )
-{
- m_pParentWindow = i_pNewParent;
-
- size_t nEle = countElements();
- for( size_t i = 0; i < nEle; i++ )
- {
- Element* pEle = getElement( i );
- if( pEle ) // sanity check
- {
- #if OSL_DEBUG_LEVEL > 0
- if( pEle->m_pElement )
- {
- OSL_VERIFY( pEle->m_pElement->GetParent() == i_pNewParent );
- }
- #endif
- if( pEle->m_pChild )
- pEle->m_pChild->setParentWindow( i_pNewParent );
- }
- }
-}
-
-void WindowArranger::show( bool i_bShow, bool i_bImmediateUpdate )
-{
- size_t nEle = countElements();
- for( size_t i = 0; i < nEle; i++ )
- {
- Element* pEle = getElement( i );
- if( pEle ) // sanity check
- {
- pEle->m_bHidden = ! i_bShow;
- if( pEle->m_pElement )
- pEle->m_pElement->Show( i_bShow );
- if( pEle->m_pChild.get() )
- pEle->m_pChild->show( i_bShow, false );
- }
- }
- if( m_pParentArranger )
- {
- nEle = m_pParentArranger->countElements();
- for( size_t i = 0; i < nEle; i++ )
- {
- Element* pEle = m_pParentArranger->getElement( i );
- if( pEle && pEle->m_pChild.get() == this )
- {
- pEle->m_bHidden = ! i_bShow;
- break;
- }
- }
- }
- if( i_bImmediateUpdate )
- {
- // find the topmost parent
- WindowArranger* pResize = this;
- while( pResize->m_pParentArranger )
- pResize = pResize->m_pParentArranger;
- pResize->resize();
- }
-}
-
-bool WindowArranger::isVisible() const
-{
- size_t nEle = countElements();
- for( size_t i = 0; i < nEle; i++ )
- {
- const Element* pEle = getConstElement( i );
- if( pEle->isVisible() )
- return true;
- }
- return false;
-}
-
-bool WindowArranger::Element::isVisible() const
-{
- bool bVisible = false;
- if( ! m_bHidden )
- {
- if( m_pElement )
- bVisible = m_pElement->IsVisible();
- else if( m_pChild )
- bVisible = m_pChild->isVisible();
- }
- return bVisible;
-}
-
-sal_Int32 WindowArranger::Element::getExpandPriority() const
-{
- sal_Int32 nPrio = m_nExpandPriority;
- if( m_pChild && m_nExpandPriority >= 0 )
- {
- size_t nElements = m_pChild->countElements();
- for( size_t i = 0; i < nElements; i++ )
- {
- sal_Int32 nCPrio = m_pChild->getExpandPriority( i );
- if( nCPrio > nPrio )
- nPrio = nCPrio;
- }
- }
- return nPrio;
-}
-
-Size WindowArranger::Element::getOptimalSize( WindowSizeType i_eType ) const
-{
- Size aResult;
- if( ! m_bHidden )
- {
- bool bVisible = false;
- if( m_pElement && m_pElement->IsVisible() )
- {
- aResult = m_pElement->GetOptimalSize( i_eType );
- bVisible = true;
- }
- else if( m_pChild && m_pChild->isVisible() )
- {
- aResult = m_pChild->getOptimalSize( i_eType );
- bVisible = true;
- }
- if( bVisible )
- {
- if( aResult.Width() < m_aMinSize.Width() )
- aResult.Width() = m_aMinSize.Width();
- if( aResult.Height() < m_aMinSize.Height() )
- aResult.Height() = m_aMinSize.Height();
- aResult.Width() += getBorderValue( m_nLeftBorder ) + getBorderValue( m_nRightBorder );
- aResult.Height() += getBorderValue( m_nTopBorder ) + getBorderValue( m_nBottomBorder );
- }
- }
-
- return aResult;
-}
-
-void WindowArranger::Element::setPosSize( const Point& i_rPos, const Size& i_rSize )
-{
- Point aPoint( i_rPos );
- Size aSize( i_rSize );
- aPoint.X() += getBorderValue( m_nLeftBorder );
- aPoint.Y() += getBorderValue( m_nTopBorder );
- aSize.Width() -= getBorderValue( m_nLeftBorder ) + getBorderValue( m_nRightBorder );
- aSize.Height() -= getBorderValue( m_nTopBorder ) + getBorderValue( m_nBottomBorder );
- if( m_pElement )
- m_pElement->SetPosSizePixel( aPoint, aSize );
- else if( m_pChild )
- m_pChild->setManagedArea( Rectangle( aPoint, aSize ) );
-}
-
-uno::Sequence< beans::PropertyValue > WindowArranger::getProperties() const
-{
- uno::Sequence< beans::PropertyValue > aRet( 3 );
- aRet[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OuterBorder" ) );
- aRet[0].Value = uno::makeAny( sal_Int32( getBorderValue( m_nOuterBorder ) ) );
- aRet[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ManagedArea" ) );
- awt::Rectangle aArea( m_aManagedArea.getX(), m_aManagedArea.getY(), m_aManagedArea.getWidth(), m_aManagedArea.getHeight() );
- aRet[1].Value = uno::makeAny( aArea );
- aRet[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) );
- aRet[2].Value = uno::makeAny( sal_Bool( isVisible() ) );
- return aRet;
-}
-
-void WindowArranger::setProperties( const uno::Sequence< beans::PropertyValue >& i_rProps )
-{
- const beans::PropertyValue* pProps = i_rProps.getConstArray();
- bool bResize = false;
- for( sal_Int32 i = 0; i < i_rProps.getLength(); i++ )
- {
- if ( pProps[i].Name == "OuterBorder" )
- {
- sal_Int32 nVal = 0;
- if( pProps[i].Value >>= nVal )
- {
- if( getBorderValue( m_nOuterBorder ) != nVal )
- {
- m_nOuterBorder = nVal;
- bResize = true;
- }
- }
- }
- else if ( pProps[i].Name == "ManagedArea" )
- {
- awt::Rectangle aArea( 0, 0, 0, 0 );
- if( pProps[i].Value >>= aArea )
- {
- m_aManagedArea.setX( aArea.X );
- m_aManagedArea.setY( aArea.Y );
- m_aManagedArea.setWidth( aArea.Width );
- m_aManagedArea.setHeight( aArea.Height );
- bResize = true;
- }
- }
- else if ( pProps[i].Name == "Visible" )
- {
- sal_Bool bVal = sal_False;
- if( pProps[i].Value >>= bVal )
- {
- show( bVal, false );
- bResize = true;
- }
- }
- }
- if( bResize )
- resize();
-}
-
-
-// ----------------------------------------
-// vcl::RowOrColumn
-//-----------------------------------------
-
-RowOrColumn::~RowOrColumn()
-{
- for( std::vector< WindowArranger::Element >::iterator it = m_aElements.begin();
- it != m_aElements.end(); ++it )
- {
- it->deleteChild();
- }
-}
-
-Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const
-{
- Size aRet( 0, 0 );
- long nDistance = getBorderValue( m_nBorderWidth );
- for( std::vector< WindowArranger::Element >::const_iterator it = m_aElements.begin();
- it != m_aElements.end(); ++it )
- {
- if( it->isVisible() )
- {
- // get the size of type of the managed element
- Size aElementSize( it->getOptimalSize( i_eType ) );
- if( m_bColumn )
- {
- // add the distance between elements
- aRet.Height() += nDistance;
- // check if the width needs adjustment
- if( aRet.Width() < aElementSize.Width() )
- aRet.Width() = aElementSize.Width();
- aRet.Height() += aElementSize.Height();
- }
- else
- {
- // add the distance between elements
- aRet.Width() += nDistance;
- // check if the height needs adjustment
- if( aRet.Height() < aElementSize.Height() )
- aRet.Height() = aElementSize.Height();
- aRet.Width() += aElementSize.Width();
- }
- }
- }
-
- if( aRet.Width() != 0 || aRet.Height() != 0 )
- {
- // subtract the border for the first element
- if( m_bColumn )
- aRet.Height() -= nDistance;
- else
- aRet.Width() -= nDistance;
-
- // add the outer border
- long nOuterBorder = getBorderValue( m_nOuterBorder );
- aRet.Width() += 2*nOuterBorder;
- aRet.Height() += 2*nOuterBorder;
- }
-
- return aRet;
-}
-
-void RowOrColumn::distributeRowWidth( std::vector<Size>& io_rSizes, long /*i_nUsedWidth*/, long i_nExtraWidth )
-{
- if( ! io_rSizes.empty() && io_rSizes.size() == m_aElements.size() )
- {
- // find all elements with the highest expand priority
- size_t nElements = m_aElements.size();
- std::vector< size_t > aIndices;
- sal_Int32 nHighPrio = 0;
- for( size_t i = 0; i < nElements; i++ )
- {
- if( m_aElements[ i ].isVisible() )
- {
- sal_Int32 nCurPrio = m_aElements[ i ].getExpandPriority();
- if( nCurPrio > nHighPrio )
- {
- aIndices.clear();
- nHighPrio = nCurPrio;
- }
- if( nCurPrio == nHighPrio )
- aIndices.push_back( i );
- }
- }
-
- // distribute extra space evenly among collected elements
- nElements = aIndices.size();
- if( nElements > 0 )
- {
- long nDelta = i_nExtraWidth / nElements;
- for( size_t i = 0; i < nElements; i++ )
- {
- io_rSizes[ aIndices[i] ].Width() += nDelta;
- i_nExtraWidth -= nDelta;
- }
- // add the last pixels to the last row element
- if( i_nExtraWidth > 0 && nElements > 0 )
- io_rSizes[aIndices.back()].Width() += i_nExtraWidth;
- }
- }
-}
-
-void RowOrColumn::distributeColumnHeight( std::vector<Size>& io_rSizes, long /*i_nUsedHeight*/, long i_nExtraHeight )
-{
- if( ! io_rSizes.empty() && io_rSizes.size() == m_aElements.size() )
- {
- // find all elements with the highest expand priority
- size_t nElements = m_aElements.size();
- std::vector< size_t > aIndices;
- sal_Int32 nHighPrio = 3;
- for( size_t i = 0; i < nElements; i++ )
- {
- if( m_aElements[ i ].isVisible() )
- {
- sal_Int32 nCurPrio = m_aElements[ i ].getExpandPriority();
- if( nCurPrio > nHighPrio )
- {
- aIndices.clear();
- nHighPrio = nCurPrio;
- }
- if( nCurPrio == nHighPrio )
- aIndices.push_back( i );
- }
- }
-
- // distribute extra space evenly among collected elements
- nElements = aIndices.size();
- if( nElements > 0 )
- {
- long nDelta = i_nExtraHeight / nElements;
- for( size_t i = 0; i < nElements; i++ )
- {
- io_rSizes[ aIndices[i] ].Height() += nDelta;
- i_nExtraHeight -= nDelta;
- }
- // add the last pixels to the last row element
- if( i_nExtraHeight > 0 && nElements > 0 )
- io_rSizes[aIndices.back()].Height() += i_nExtraHeight;
- }
- }
-}
-
-void RowOrColumn::resize()
-{
- // check if we can get optimal size, else fallback to minimal size
- Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED ) );
- WindowSizeType eType = WINDOWSIZE_PREFERRED;
- if( m_bColumn )
- {
- if( aOptSize.Height() > m_aManagedArea.GetHeight() )
- eType = WINDOWSIZE_MINIMUM;
- }
- else
- {
- if( aOptSize.Width() > m_aManagedArea.GetWidth() )
- eType = WINDOWSIZE_MINIMUM;
- }
-
- size_t nElements = m_aElements.size();
- // get all element sizes for sizing
- std::vector<Size> aElementSizes( nElements );
- long nDistance = getBorderValue( m_nBorderWidth );
- long nOuterBorder = getBorderValue( m_nOuterBorder );
- long nUsedWidth = 2*nOuterBorder - (nElements ? nDistance : 0);
- for( size_t i = 0; i < nElements; i++ )
- {
- if( m_aElements[i].isVisible() )
- {
- aElementSizes[i] = m_aElements[i].getOptimalSize( eType );
- if( m_bColumn )
- {
- aElementSizes[i].Width() = m_aManagedArea.GetWidth() - 2 * nOuterBorder;
- nUsedWidth += aElementSizes[i].Height() + nDistance;
- }
- else
- {
- aElementSizes[i].Height() = m_aManagedArea.GetHeight() - 2 * nOuterBorder;
- nUsedWidth += aElementSizes[i].Width() + nDistance;
- }
- }
- }
-
- long nExtraWidth = (m_bColumn ? m_aManagedArea.GetHeight() : m_aManagedArea.GetWidth()) - nUsedWidth;
- if( nExtraWidth > 0 )
- {
- if( m_bColumn )
- distributeColumnHeight( aElementSizes, nUsedWidth, nExtraWidth );
- else
- distributeRowWidth( aElementSizes, nUsedWidth, nExtraWidth );
- }
-
- // get starting position
- Point aElementPos( m_aManagedArea.TopLeft() );
- // outer border
- aElementPos.X() += nOuterBorder;
- aElementPos.Y() += nOuterBorder;
-
- // position managed windows
- for( size_t i = 0; i < nElements; i++ )
- {
- // get the size of type of the managed element
- if( m_aElements[i].isVisible() )
- {
- m_aElements[i].setPosSize( aElementPos, aElementSizes[i] );
- if( m_bColumn )
- aElementPos.Y() += nDistance + aElementSizes[i].Height();
- else
- aElementPos.X() += nDistance + aElementSizes[i].Width();
- }
- }
-}
-
-size_t RowOrColumn::addWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio, const Size& i_rMinSize, size_t i_nIndex )
-{
- size_t nIndex = i_nIndex;
- if( i_nIndex >= m_aElements.size() )
- {
- nIndex = m_aElements.size();
- m_aElements.push_back( WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio, i_rMinSize ) );
- }
- else
- {
- std::vector< WindowArranger::Element >::iterator it = m_aElements.begin();
- while( i_nIndex-- )
- ++it;
- m_aElements.insert( it, WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio, i_rMinSize ) );
- }
- return nIndex;
-}
-
-size_t RowOrColumn::addChild( boost::shared_ptr<WindowArranger> const & i_pChild, sal_Int32 i_nExpandPrio, size_t i_nIndex )
-{
- size_t nIndex = i_nIndex;
- if( i_nIndex >= m_aElements.size() )
- {
- nIndex = m_aElements.size();
- m_aElements.push_back( WindowArranger::Element( NULL, i_pChild, i_nExpandPrio ) );
- }
- else
- {
- std::vector< WindowArranger::Element >::iterator it = m_aElements.begin();
- while( i_nIndex-- )
- ++it;
- m_aElements.insert( it, WindowArranger::Element( NULL, i_pChild, i_nExpandPrio ) );
- }
- return nIndex;
-}
-
-// ----------------------------------------
-// vcl::LabeledElement
-//-----------------------------------------
-
-LabeledElement::~LabeledElement()
-{
- m_aLabel.deleteChild();
- m_aElement.deleteChild();
-}
-
-Size LabeledElement::getOptimalSize( WindowSizeType i_eType ) const
-{
- Size aRet( m_aLabel.getOptimalSize( WINDOWSIZE_MINIMUM ) );
- if( aRet.Width() != 0 )
- {
- if( m_nLabelColumnWidth != 0 )
- aRet.Width() = m_nLabelColumnWidth;
- else
- aRet.Width() += getBorderValue( m_nDistance );
- }
- Size aElementSize( m_aElement.getOptimalSize( i_eType ) );
- aRet.Width() += aElementSize.Width();
- if( aElementSize.Height() > aRet.Height() )
- aRet.Height() = aElementSize.Height();
- if( aRet.Height() != 0 )
- aRet.Height() += 2 * getBorderValue( m_nOuterBorder );
-
- return aRet;
-}
-
-void LabeledElement::resize()
-{
- Size aLabelSize( m_aLabel.getOptimalSize( WINDOWSIZE_MINIMUM ) );
- Size aElementSize( m_aElement.getOptimalSize( WINDOWSIZE_PREFERRED ) );
- long nDistance = getBorderValue( m_nDistance );
- long nOuterBorder = getBorderValue( m_nOuterBorder );
- if( nDistance + aLabelSize.Width() + aElementSize.Width() > m_aManagedArea.GetWidth() )
- aElementSize = m_aElement.getOptimalSize( WINDOWSIZE_MINIMUM );
-
- // align label and element vertically in LabeledElement
- long nYOff = (m_aManagedArea.GetHeight() - 2*nOuterBorder - aLabelSize.Height()) / 2;
- Point aPos( m_aManagedArea.Left(),
- m_aManagedArea.Top() + nOuterBorder + nYOff );
- Size aSize( aLabelSize );
- if( m_nLabelColumnWidth != 0 )
- aSize.Width() = m_nLabelColumnWidth;
- m_aLabel.setPosSize( aPos, aSize );
-
- aPos.X() += aSize.Width() + nDistance;
- nYOff = (m_aManagedArea.GetHeight() - 2*nOuterBorder - aElementSize.Height()) / 2;
- aPos.Y() = m_aManagedArea.Top() + nOuterBorder + nYOff;
- aSize.Width() = aElementSize.Width();
- aSize.Height() = m_aManagedArea.GetHeight() - 2*nOuterBorder;
-
- // label style
- // 0: position left and right
- // 1: keep the element close to label and grow it
- // 2: keep the element close and don't grow it
- if( m_nLabelStyle == 0)
- {
- if( aPos.X() + aSize.Width() < m_aManagedArea.Right() )
- aPos.X() = m_aManagedArea.Right() - aSize.Width();
- }
- else if( m_nLabelStyle == 1 )
- {
- if( aPos.X() + aSize.Width() < m_aManagedArea.Right() )
- aSize.Width() = m_aManagedArea.Right() - aPos.X();
- }
- m_aElement.setPosSize( aPos, aSize );
-}
-
-void LabeledElement::setLabel( Window* i_pLabel )
-{
- m_aLabel.m_pElement = i_pLabel;
- m_aLabel.m_pChild.reset();
-}
-
-void LabeledElement::setElement( Window* i_pElement )
-{
- m_aElement.m_pElement = i_pElement;
- m_aElement.m_pChild.reset();
-}
-
-void LabeledElement::setElement( boost::shared_ptr<WindowArranger> const & i_pElement )
-{
- m_aElement.m_pElement = NULL;
- m_aElement.m_pChild = i_pElement;
-}
-
-// ----------------------------------------
-// vcl::LabelColumn
-//-----------------------------------------
-LabelColumn::~LabelColumn()
-{
-}
-
-long LabelColumn::getLabelWidth() const
-{
- long nWidth = 0;
-
- size_t nEle = countElements();
- for( size_t i = 0; i < nEle; i++ )
- {
- const Element* pEle = getConstElement( i );
- if( pEle && pEle->m_pChild.get() )
- {
- const LabeledElement* pLabel = dynamic_cast< const LabeledElement* >(pEle->m_pChild.get());
- if( pLabel )
- {
- Window* pLW = pLabel->getWindow( 0 );
- if( pLW )
- {
- Size aLabSize( pLW->GetOptimalSize( WINDOWSIZE_MINIMUM ) );
- long nLB = 0;
- pLabel->getBorders(0, &nLB);
- aLabSize.Width() += getBorderValue( nLB );
- if( aLabSize.Width() > nWidth )
- nWidth = aLabSize.Width();
- }
- }
- }
- }
- return nWidth + getBorderValue( getBorderWidth() );
-}
-
-Size LabelColumn::getOptimalSize( WindowSizeType i_eType ) const
-{
- long nWidth = getLabelWidth();
- long nOuterBorder = getBorderValue( m_nOuterBorder );
- Size aColumnSize;
-
- // every child is a LabeledElement
- size_t nEle = countElements();
- for( size_t i = 0; i < nEle; i++ )
- {
- Size aElementSize;
- const Element* pEle = getConstElement( i );
- if( pEle && pEle->m_pChild.get() )
- {
- const LabeledElement* pLabel = dynamic_cast< const LabeledElement* >(pEle->m_pChild.get());
- if( pLabel ) // we have a label
- {
- aElementSize = pLabel->getLabelSize( WINDOWSIZE_MINIMUM );
- if( aElementSize.Width() )
- aElementSize.Width() = nWidth;
- Size aSize( pLabel->getElementSize( i_eType ) );
- aElementSize.Width() += aSize.Width();
- if( aSize.Height() > aElementSize.Height() )
- aElementSize.Height() = aSize.Height();
- }
- else // a non label, just treat it as a row
- {
- aElementSize = pEle->getOptimalSize( i_eType );
- }
- }
- else if( pEle && pEle->m_pElement ) // a general window, treat is as a row
- {
- aElementSize = pEle->getOptimalSize( i_eType );
- }
- if( aElementSize.Width() )
- {
- aElementSize.Width() += 2*nOuterBorder;
- if( aElementSize.Width() > aColumnSize.Width() )
- aColumnSize.Width() = aElementSize.Width();
- }
- if( aElementSize.Height() )
- {
- aColumnSize.Height() += getBorderValue( getBorderWidth() ) + aElementSize.Height();
- }
- }
- if( nEle > 0 && aColumnSize.Height() )
- {
- aColumnSize.Height() -= getBorderValue( getBorderWidth() ); // for the first element
- aColumnSize.Height() += 2*nOuterBorder;
- }
- return aColumnSize;
-}
-
-void LabelColumn::resize()
-{
- long nWidth = getLabelWidth();
- size_t nEle = countElements();
- for( size_t i = 0; i < nEle; i++ )
- {
- Element* pEle = getElement( i );
- if( pEle && pEle->m_pChild.get() )
- {
- LabeledElement* pLabel = dynamic_cast< LabeledElement* >(pEle->m_pChild.get());
- if( pLabel )
- pLabel->setLabelColumnWidth( nWidth );
- }
- }
- RowOrColumn::resize();
-}
-
-size_t LabelColumn::addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger> const& i_rElement, long i_nIndent )
-{
- boost::shared_ptr< LabeledElement > xLabel( new LabeledElement( this, 1 ) );
- xLabel->setLabel( i_pLabel );
- xLabel->setBorders( 0, i_nIndent, 0, 0, 0 );
- xLabel->setElement( i_rElement );
- size_t nIndex = addChild( xLabel );
- resize();
- return nIndex;
-}
-
-// ----------------------------------------
-// vcl::Indenter
-//-----------------------------------------
-
-Indenter::~Indenter()
-{
- m_aElement.deleteChild();
-}
-
-Size Indenter::getOptimalSize( WindowSizeType i_eType ) const
-{
- Size aSize( m_aElement.getOptimalSize( i_eType ) );
- long nOuterBorder = getBorderValue( m_nOuterBorder );
- long nIndent = getBorderValue( m_nIndent );
- aSize.Width() += 2*nOuterBorder + nIndent;
- aSize.Height() += 2*nOuterBorder;
- return aSize;
-}
-
-void Indenter::resize()
-{
- long nOuterBorder = getBorderValue( m_nOuterBorder );
- long nIndent = getBorderValue( m_nIndent );
- Point aPt( m_aManagedArea.TopLeft() );
- aPt.X() += nOuterBorder + nIndent;
- aPt.Y() += nOuterBorder;
- Size aSz( m_aManagedArea.GetSize() );
- aSz.Width() -= 2*nOuterBorder + nIndent;
- aSz.Height() -= 2*nOuterBorder;
- m_aElement.setPosSize( aPt, aSz );
-}
-
-void Indenter::setChild( boost::shared_ptr<WindowArranger> const & i_pChild, sal_Int32 i_nExpandPrio )
-{
- OSL_VERIFY( (m_aElement.m_pElement == 0 && m_aElement.m_pChild == 0 ) || i_pChild == 0 );
- m_aElement.m_pChild = i_pChild;
- m_aElement.m_nExpandPriority = i_nExpandPrio;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index d874d81..7d21da6 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -604,7 +604,6 @@ void Window::ImplInitWindowData( WindowType nType )
mpWindowImpl->mpDlgCtrlDownWindow = NULL; // window for dialog control
mpWindowImpl->mpFirstDel = NULL; // Dtor notification list
mpWindowImpl->mpUserData = NULL; // user data
- mpWindowImpl->mpExtImpl = NULL; // extended implementation data
mpWindowImpl->mpCursor = NULL; // cursor
mpWindowImpl->mpControlFont = NULL; // font propertie
mpWindowImpl->mpVCLXWindow = NULL;
@@ -1180,8 +1179,6 @@ void Window::ImplCallResize()
// #88419# Most classes don't call the base class in Resize() and Move(),
// => Call ImpleResize/Move instead of Resize/Move directly...
ImplCallEventListeners( VCLEVENT_WINDOW_RESIZE );
-
- ImplExtResize();
}
// -----------------------------------------------------------------------
@@ -4258,8 +4255,6 @@ namespace
Window::~Window()
{
- ImplFreeExtWindowImpl();
-
vcl::LazyDeletor<Window>::Undelete( this );
DBG_DTOR( Window, ImplDbgCheckWindow );
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index d73c7b8..5bd02d9 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1799,7 +1799,6 @@ void Window::take_properties(Window &rOther)
if (!mpWindowImpl->mpRealParent)
ImplInit(pWindowImpl->mpRealParent, rOther.GetStyle(), NULL);
std::swap(mpWindowImpl->mpUserData, pWindowImpl->mpUserData);
- std::swap(mpWindowImpl->mpExtImpl, pWindowImpl->mpExtImpl);
std::swap(mpWindowImpl->mpCursor, pWindowImpl->mpCursor);
std::swap(mpWindowImpl->maPointer, pWindowImpl->maPointer);
mpWindowImpl->maZoom = pWindowImpl->maZoom;
diff --git a/vcl/source/window/window4.cxx b/vcl/source/window/window4.cxx
deleted file mode 100644
index af22d66..0000000
--- a/vcl/source/window/window4.cxx
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#include "vcl/window.hxx"
-#include "vcl/arrange.hxx"
-
-#include "window.h"
-#include "svdata.hxx"
-
-#include "com/sun/star/beans/PropertyValue.hpp"
-
-#include <map>
-#include <vector>
-
-using namespace com::sun::star;
-
-namespace vcl
-{
- struct ExtWindowImpl
- {
- ExtWindowImpl()
- : mbOwnedByParent( false )
- {}
- ~ExtWindowImpl()
- {}
-
- boost::shared_ptr< WindowArranger > mxLayout;
- bool mbOwnedByParent;
- rtl::OUString maIdentifier;
- };
-}
-
-void Window::ImplDeleteOwnedChildren()
-{
- Window* pChild = mpWindowImpl->mpFirstChild;
- while ( pChild )
- {
- Window* pDeleteCandidate = pChild;
- pChild = pChild->mpWindowImpl->mpNext;
- vcl::ExtWindowImpl* pDelImpl = pDeleteCandidate->ImplGetExtWindowImpl();
- if( pDelImpl && pDelImpl->mbOwnedByParent )
- delete pDeleteCandidate;
- }
-}
-
-void Window::ImplFreeExtWindowImpl()
-{
- ImplDeleteOwnedChildren();
- if( mpWindowImpl )
- {
- delete mpWindowImpl->mpExtImpl;
- mpWindowImpl->mpExtImpl = NULL;
- }
-}
-
-vcl::ExtWindowImpl* Window::ImplGetExtWindowImpl() const
-{
- vcl::ExtWindowImpl* pImpl = NULL;
- if( mpWindowImpl )
- {
- if( ! mpWindowImpl->mpExtImpl && ! mpWindowImpl->mbInDtor )
- mpWindowImpl->mpExtImpl = new vcl::ExtWindowImpl();
- pImpl = mpWindowImpl->mpExtImpl;
- }
- return pImpl;
-}
-
-void Window::ImplExtResize()
-{
- if( mpWindowImpl && mpWindowImpl->mpExtImpl )
- {
- if( mpWindowImpl->mpExtImpl->mxLayout.get() )
- mpWindowImpl->mpExtImpl->mxLayout->setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
- }
-}
-
-Window* Window::findWindow( const rtl::OUString& i_rIdentifier ) const
-{
- if( getIdentifier() == i_rIdentifier )
- return const_cast<Window*>(this);
-
- Window* pChild = mpWindowImpl->mpFirstChild;
- while ( pChild )
- {
- Window* pResult = pChild->findWindow( i_rIdentifier );
- if( pResult )
- return pResult;
- pChild = pChild->mpWindowImpl->mpNext;
- }
-
- return NULL;
-}
-
-const rtl::OUString& Window::getIdentifier() const
-{
- static rtl::OUString aEmptyStr;
-
- return (mpWindowImpl && mpWindowImpl->mpExtImpl) ? mpWindowImpl->mpExtImpl->maIdentifier : aEmptyStr;
-}
-
-void Window::setProperties( const uno::Sequence< beans::PropertyValue >& i_rProps )
-{
- const beans::PropertyValue* pVals = i_rProps.getConstArray();
- for( sal_Int32 i = 0; i < i_rProps.getLength(); i++ )
- {
- if ( pVals[i].Name == "Enabled" )
- {
- sal_Bool bVal = sal_True;
- if( pVals[i].Value >>= bVal )
- Enable( bVal );
- }
- else if ( pVals[i].Name == "Visible" )
- {
- sal_Bool bVal = sal_True;
- if( pVals[i].Value >>= bVal )
- Show( bVal );
- }
- else if ( pVals[i].Name == "Text" )
- {
- rtl::OUString aText;
- if( pVals[i].Value >>= aText )
- SetText( aText );
- }
- }
-}
-
-uno::Sequence< beans::PropertyValue > Window::getProperties() const
-{
- uno::Sequence< beans::PropertyValue > aProps( 3 );
- aProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) );
- aProps[0].Value = uno::makeAny( sal_Bool( IsEnabled() ) );
- aProps[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) );
- aProps[1].Value = uno::makeAny( sal_Bool( IsVisible() ) );
- aProps[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) );
- aProps[2].Value = uno::makeAny( rtl::OUString( GetText() ) );
-
- return aProps;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit fc8796c9737e1ea6d5b2d0750d9f6534420f6755
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 9 17:08:43 2012 +0100
fix some mangled indents
Change-Id: I96169ac205ad5c794f0545aa46c05f73e433629a
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index d453198..acbc7c7 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -476,7 +476,7 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
int nDepth, GC gc, ControlPart nPart )
{
if ( !pWidget )
- return sal_False;
+ return sal_False;
// Normalize the widget
QPoint qWidgetPos( pWidget->pos() );
@@ -502,156 +502,156 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
// Draw the widget to the pixmap
if ( strcmp( QPushButton_String, pClassName ) == 0 )
{
- // Workaround for the Platinum style.
- // Platinum takes the state directly from the widget, not from SFlags.
- QPushButton *pPushButton = static_cast<QPushButton *>( pWidget->qt_cast( QPushButton_String ) );
- if ( pPushButton )
- {
- pPushButton->setDown ( nStyle & QStyle::Style_Down );
- pPushButton->setOn ( nStyle & QStyle::Style_On );
- pPushButton->setEnabled( nStyle & QStyle::Style_Enabled );
- }
+ // Workaround for the Platinum style.
+ // Platinum takes the state directly from the widget, not from SFlags.
+ QPushButton *pPushButton = static_cast<QPushButton *>( pWidget->qt_cast( QPushButton_String ) );
+ if ( pPushButton )
+ {
+ pPushButton->setDown ( nStyle & QStyle::Style_Down );
+ pPushButton->setOn ( nStyle & QStyle::Style_On );
+ pPushButton->setEnabled( nStyle & QStyle::Style_Enabled );
+ }
- kapp->style().drawControl( QStyle::CE_PushButton,
- &qPainter, pWidget, qRect,
- pWidget->colorGroup(), nStyle );
+ kapp->style().drawControl( QStyle::CE_PushButton,
+ &qPainter, pWidget, qRect,
+ pWidget->colorGroup(), nStyle );
}
else if ( strcmp( QRadioButton_String, pClassName ) == 0 )
{
- // Bitblt from the screen, because the radio buttons are usually not
- // rectangular, and there could be a bitmap under them
- GC aTmpGC = XCreateGC( dpy, qPixmap.handle(), 0, NULL );
- X11SalGraphics::CopyScreenArea(
- dpy,
- drawable, nXScreen, nDepth,
- qPixmap.handle(), SalX11Screen( qPixmap.x11Screen() ), qPixmap.x11Depth(),
- aTmpGC,
- qWidgetPos.x(), qWidgetPos.y(), qRect.width(), qRect.height(),
- 0, 0 );
- XFreeGC( dpy, aTmpGC );
-
- kapp->style().drawControl( QStyle::CE_RadioButton,
- &qPainter, pWidget, qRect,
- pWidget->colorGroup(), nStyle );
+ // Bitblt from the screen, because the radio buttons are usually not
+ // rectangular, and there could be a bitmap under them
+ GC aTmpGC = XCreateGC( dpy, qPixmap.handle(), 0, NULL );
+ X11SalGraphics::CopyScreenArea(
+ dpy,
+ drawable, nXScreen, nDepth,
+ qPixmap.handle(), SalX11Screen( qPixmap.x11Screen() ), qPixmap.x11Depth(),
+ aTmpGC,
+ qWidgetPos.x(), qWidgetPos.y(), qRect.width(), qRect.height(),
+ 0, 0 );
+ XFreeGC( dpy, aTmpGC );
+
+ kapp->style().drawControl( QStyle::CE_RadioButton,
+ &qPainter, pWidget, qRect,
+ pWidget->colorGroup(), nStyle );
}
else if ( strcmp( QCheckBox_String, pClassName ) == 0 )
{
- kapp->style().drawControl( QStyle::CE_CheckBox,
- &qPainter, pWidget, qRect,
- pWidget->colorGroup(), nStyle );
+ kapp->style().drawControl( QStyle::CE_CheckBox,
+ &qPainter, pWidget, qRect,
+ pWidget->colorGroup(), nStyle );
}
else if ( strcmp( QComboBox_String, pClassName ) == 0 )
{
- kapp->style().drawComplexControl( QStyle::CC_ComboBox,
- &qPainter, pWidget, qRect,
- pWidget->colorGroup(), nStyle );
+ kapp->style().drawComplexControl( QStyle::CC_ComboBox,
+ &qPainter, pWidget, qRect,
+ pWidget->colorGroup(), nStyle );
- // Editable combo box uses the background of the associated edit box
- QComboBox *pComboBox = static_cast<QComboBox *>( pWidget->qt_cast( QComboBox_String ) );
- if ( pComboBox && pComboBox->editable() && pComboBox->lineEdit() )
- {
- QColorGroup::ColorRole eColorRole = ( pComboBox->isEnabled() )?
- QColorGroup::Base: QColorGroup::Background;
- qPainter.fillRect(
- kapp->style().querySubControlMetrics( QStyle::CC_ComboBox,
- pComboBox, QStyle::SC_ComboBoxEditField ),
- pComboBox->lineEdit()->colorGroup().brush( eColorRole ) );
- }
+ // Editable combo box uses the background of the associated edit box
+ QComboBox *pComboBox = static_cast<QComboBox *>( pWidget->qt_cast( QComboBox_String ) );
+ if ( pComboBox && pComboBox->editable() && pComboBox->lineEdit() )
+ {
+ QColorGroup::ColorRole eColorRole = ( pComboBox->isEnabled() )?
+ QColorGroup::Base: QColorGroup::Background;
+ qPainter.fillRect(
+ kapp->style().querySubControlMetrics( QStyle::CC_ComboBox,
+ pComboBox, QStyle::SC_ComboBoxEditField ),
+ pComboBox->lineEdit()->colorGroup().brush( eColorRole ) );
+ }
}
else if ( strcmp( QLineEdit_String, pClassName ) == 0 )
{
- kapp->style().drawPrimitive( QStyle::PE_PanelLineEdit,
- &qPainter, qRect,
- pWidget->colorGroup(), nStyle | QStyle::Style_Sunken );
+ kapp->style().drawPrimitive( QStyle::PE_PanelLineEdit,
+ &qPainter, qRect,
+ pWidget->colorGroup(), nStyle | QStyle::Style_Sunken );
}
else if ( strcmp( QSpinWidget_String, pClassName ) == 0 )
{
- const SpinbuttonValue *pValue = static_cast<const SpinbuttonValue *> ( &aValue );
-
- // Is any of the buttons pressed?
- QStyle::SCFlags eActive = QStyle::SC_None;
- if ( pValue )
- {
- if ( pValue->mnUpperState & CTRL_STATE_PRESSED )
- eActive = QStyle::SC_SpinWidgetUp;
- else if ( pValue->mnLowerState & CTRL_STATE_PRESSED )
- eActive = QStyle::SC_SpinWidgetDown;
+ const SpinbuttonValue *pValue = static_cast<const SpinbuttonValue *> ( &aValue );
- // Update the enable/disable state of the widget
- if ( ( nState & CTRL_STATE_ENABLED ) ||
- ( pValue->mnUpperState & CTRL_STATE_ENABLED ) ||
- ( pValue->mnLowerState & CTRL_STATE_ENABLED ) )
+ // Is any of the buttons pressed?
+ QStyle::SCFlags eActive = QStyle::SC_None;
+ if ( pValue )
{
- pWidget->setEnabled( true );
- nStyle |= QStyle::Style_Enabled;
- }
- else
- pWidget->setEnabled( false );
+ if ( pValue->mnUpperState & CTRL_STATE_PRESSED )
+ eActive = QStyle::SC_SpinWidgetUp;
+ else if ( pValue->mnLowerState & CTRL_STATE_PRESSED )
+ eActive = QStyle::SC_SpinWidgetDown;
+
+ // Update the enable/disable state of the widget
+ if ( ( nState & CTRL_STATE_ENABLED ) ||
+ ( pValue->mnUpperState & CTRL_STATE_ENABLED ) ||
+ ( pValue->mnLowerState & CTRL_STATE_ENABLED ) )
+ {
+ pWidget->setEnabled( true );
+ nStyle |= QStyle::Style_Enabled;
+ }
+ else
+ pWidget->setEnabled( false );
- // Mouse-over effect
- if ( (pValue->mnUpperState & CTRL_STATE_ROLLOVER) ||
- (pValue->mnLowerState & CTRL_STATE_ROLLOVER) )
- nStyle |= QStyle::Style_MouseOver;
- }
+ // Mouse-over effect
+ if ( (pValue->mnUpperState & CTRL_STATE_ROLLOVER) ||
+ (pValue->mnLowerState & CTRL_STATE_ROLLOVER) )
+ nStyle |= QStyle::Style_MouseOver;
+ }
- // Spin widget uses the background of the associated edit box
- QSpinWidget *pSpinWidget = static_cast<QSpinWidget *>( pWidget->qt_cast( QSpinWidget_String ) );
- if ( pSpinWidget && pSpinWidget->editWidget() )
- {
- QColorGroup::ColorRole eColorRole = ( pSpinWidget->isEnabled() )?
- QColorGroup::Base: QColorGroup::Background;
- qPainter.fillRect(
- kapp->style().querySubControlMetrics( QStyle::CC_SpinWidget,
- pSpinWidget, QStyle::SC_SpinWidgetEditField ),
- pSpinWidget->editWidget()->colorGroup().brush( eColorRole ) );
- }
+ // Spin widget uses the background of the associated edit box
+ QSpinWidget *pSpinWidget = static_cast<QSpinWidget *>( pWidget->qt_cast( QSpinWidget_String ) );
+ if ( pSpinWidget && pSpinWidget->editWidget() )
+ {
+ QColorGroup::ColorRole eColorRole = ( pSpinWidget->isEnabled() )?
+ QColorGroup::Base: QColorGroup::Background;
+ qPainter.fillRect(
+ kapp->style().querySubControlMetrics( QStyle::CC_SpinWidget,
+ pSpinWidget, QStyle::SC_SpinWidgetEditField ),
+ pSpinWidget->editWidget()->colorGroup().brush( eColorRole ) );
+ }
- // Adjust the frame (needed for Motif Plus style)
- QRect qFrameRect = kapp->style().querySubControlMetrics( QStyle::CC_SpinWidget,
- pWidget, QStyle::SC_SpinWidgetFrame );
+ // Adjust the frame (needed for Motif Plus style)
+ QRect qFrameRect = kapp->style().querySubControlMetrics( QStyle::CC_SpinWidget,
+ pWidget, QStyle::SC_SpinWidgetFrame );
- kapp->style().drawComplexControl( QStyle::CC_SpinWidget,
- &qPainter, pWidget, qFrameRect,
- pWidget->colorGroup(), nStyle,
- QStyle::SC_All, eActive );
+ kapp->style().drawComplexControl( QStyle::CC_SpinWidget,
+ &qPainter, pWidget, qFrameRect,
+ pWidget->colorGroup(), nStyle,
+ QStyle::SC_All, eActive );
}
else if ( strcmp( QTabBar_String, pClassName ) == 0 )
{
- const TabitemValue *pValue = static_cast<const TabitemValue *> ( &aValue );
+ const TabitemValue *pValue = static_cast<const TabitemValue *> ( &aValue );
- QTab *pTab = NULL;
- if ( pValue )
- {
- if ( ( pValue->isFirst() || pValue->isLeftAligned() ) && ( pValue->isLast() || pValue->isRightAligned() ) )
- pTab = m_pTabAlone;
- else if ( pValue->isFirst() || pValue->isLeftAligned() )
- pTab = m_pTabLeft;
- else if ( pValue->isLast() || pValue->isRightAligned() )
- pTab = m_pTabRight;
- else
- pTab = m_pTabMiddle;
- }
- if ( !pTab )
- return sal_False;
+ QTab *pTab = NULL;
+ if ( pValue )
+ {
+ if ( ( pValue->isFirst() || pValue->isLeftAligned() ) && ( pValue->isLast() || pValue->isRightAligned() ) )
+ pTab = m_pTabAlone;
+ else if ( pValue->isFirst() || pValue->isLeftAligned() )
+ pTab = m_pTabLeft;
+ else if ( pValue->isLast() || pValue->isRightAligned() )
+ pTab = m_pTabRight;
+ else
+ pTab = m_pTabMiddle;
+ }
+ if ( !pTab )
+ return sal_False;
- pTab->setRect( qRect );
+ pTab->setRect( qRect );
- kapp->style().drawControl( QStyle::CE_TabBarTab,
- &qPainter, pWidget, qRect,
- pWidget->colorGroup(), nStyle,
- QStyleOption( pTab ) );
+ kapp->style().drawControl( QStyle::CE_TabBarTab,
+ &qPainter, pWidget, qRect,
+ pWidget->colorGroup(), nStyle,
+ QStyleOption( pTab ) );
}
else if ( strcmp( QTabWidget_String, pClassName ) == 0 )
{
- kapp->style().drawPrimitive( QStyle::PE_PanelTabWidget,
- &qPainter, qRect,
- pWidget->colorGroup(), nStyle );
+ kapp->style().drawPrimitive( QStyle::PE_PanelTabWidget,
+ &qPainter, qRect,
+ pWidget->colorGroup(), nStyle );
}
else if ( strcmp( QListView_String, pClassName ) == 0 )
{
- kapp->style().drawPrimitive( QStyle::PE_Panel,
- &qPainter, qRect,
- pWidget->colorGroup(), nStyle | QStyle::Style_Sunken );
+ kapp->style().drawPrimitive( QStyle::PE_Panel,
+ &qPainter, qRect,
+ pWidget->colorGroup(), nStyle | QStyle::Style_Sunken );
}
else if ( strcmp( QScrollBar_String, pClassName ) == 0 )
{
@@ -665,31 +665,31 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
const char *pStyleName = kapp->style().className();
if ( strcmp( QMotifPlusStyle_String, pStyleName ) == 0 )
{
- nStyle |= QStyle::Style_MouseOver;
- if ( pValue->mnThumbState & CTRL_STATE_ROLLOVER )
- eActive = QStyle::SC_ScrollBarSlider;
+ nStyle |= QStyle::Style_MouseOver;
+ if ( pValue->mnThumbState & CTRL_STATE_ROLLOVER )
+ eActive = QStyle::SC_ScrollBarSlider;
}
else if ( strcmp( QSGIStyle_String, pStyleName ) == 0 )
{
- nStyle |= QStyle::Style_MouseOver;
- if ( pValue->mnButton1State & CTRL_STATE_ROLLOVER )
- eActive = QStyle::SC_ScrollBarSubLine;
- else if ( pValue->mnButton2State & CTRL_STATE_ROLLOVER )
- eActive = QStyle::SC_ScrollBarAddLine;
- else if ( pValue->mnThumbState & CTRL_STATE_ROLLOVER )
- eActive = QStyle::SC_ScrollBarSlider;
+ nStyle |= QStyle::Style_MouseOver;
+ if ( pValue->mnButton1State & CTRL_STATE_ROLLOVER )
+ eActive = QStyle::SC_ScrollBarSubLine;
+ else if ( pValue->mnButton2State & CTRL_STATE_ROLLOVER )
+ eActive = QStyle::SC_ScrollBarAddLine;
+ else if ( pValue->mnThumbState & CTRL_STATE_ROLLOVER )
+ eActive = QStyle::SC_ScrollBarSlider;
}
if ( pValue->mnButton1State & CTRL_STATE_PRESSED )
- eActive = QStyle::SC_ScrollBarSubLine;
+ eActive = QStyle::SC_ScrollBarSubLine;
else if ( pValue->mnButton2State & CTRL_STATE_PRESSED )
- eActive = QStyle::SC_ScrollBarAddLine;
+ eActive = QStyle::SC_ScrollBarAddLine;
else if ( pValue->mnThumbState & CTRL_STATE_PRESSED )
- eActive = QStyle::SC_ScrollBarSlider;
+ eActive = QStyle::SC_ScrollBarSlider;
else if ( pValue->mnPage1State & CTRL_STATE_PRESSED )
- eActive = QStyle::SC_ScrollBarSubPage;
+ eActive = QStyle::SC_ScrollBarSubPage;
else if ( pValue->mnPage2State & CTRL_STATE_PRESSED )
- eActive = QStyle::SC_ScrollBarAddPage;
+ eActive = QStyle::SC_ScrollBarAddPage;
// Update the enable/disable state of the widget
if ( ( nState & CTRL_STATE_ENABLED ) ||
@@ -699,11 +699,11 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
( pValue->mnPage1State & CTRL_STATE_ENABLED ) ||
( pValue->mnPage2State & CTRL_STATE_ENABLED ) )
{
- pWidget->setEnabled( true );
- nStyle |= QStyle::Style_Enabled;
+ pWidget->setEnabled( true );
+ nStyle |= QStyle::Style_Enabled;
}
else
- pWidget->setEnabled( false );
+ pWidget->setEnabled( false );
}
// Is it a horizontal scroll bar?
@@ -820,7 +820,7 @@ sal_Bool WidgetPainter::drawStyledWidget( QWidget *pWidget,
pWidget->colorGroup(), nStyle );
}
else
- return sal_False;
+ return sal_False;
// Bitblt it to the screen
X11SalGraphics::CopyScreenArea(
@@ -840,7 +840,7 @@ QPushButton *WidgetPainter::pushButton( const Rectangle& rControlRegion,
sal_Bool bDefault )
{
if ( !m_pPushButton )
- m_pPushButton = new QPushButton( NULL, "push_button" );
+ m_pPushButton = new QPushButton( NULL, "push_button" );
QRect qRect = region2QRect( rControlRegion );
@@ -850,20 +850,20 @@ QPushButton *WidgetPainter::pushButton( const Rectangle& rControlRegion,
// FIXME Fix Keramik style to be consistant with Qt built-in styles. Aargh!
if ( bDefault )
{
- QSize qContentsSize( 50, 50 );
- m_pPushButton->setDefault( false );
- QSize qNormalSize = kapp->style().sizeFromContents( QStyle::CT_PushButton,
- m_pPushButton, qContentsSize );
- m_pPushButton->setDefault( true );
- QSize qDefSize = kapp->style().sizeFromContents( QStyle::CT_PushButton,
- m_pPushButton, qContentsSize );
-
- int nIndicatorSize = kapp->style().pixelMetric(
- QStyle::PM_ButtonDefaultIndicator, m_pPushButton );
- if ( qNormalSize.width() == qDefSize.width() )
- qRect.addCoords( nIndicatorSize, 0, -nIndicatorSize, 0 );
- if ( qNormalSize.height() == qDefSize.height() )
- qRect.addCoords( 0, nIndicatorSize, 0, -nIndicatorSize );
+ QSize qContentsSize( 50, 50 );
+ m_pPushButton->setDefault( false );
+ QSize qNormalSize = kapp->style().sizeFromContents( QStyle::CT_PushButton,
+ m_pPushButton, qContentsSize );
+ m_pPushButton->setDefault( true );
+ QSize qDefSize = kapp->style().sizeFromContents( QStyle::CT_PushButton,
+ m_pPushButton, qContentsSize );
+
+ int nIndicatorSize = kapp->style().pixelMetric(
+ QStyle::PM_ButtonDefaultIndicator, m_pPushButton );
+ if ( qNormalSize.width() == qDefSize.width() )
+ qRect.addCoords( nIndicatorSize, 0, -nIndicatorSize, 0 );
+ if ( qNormalSize.height() == qDefSize.height() )
+ qRect.addCoords( 0, nIndicatorSize, 0, -nIndicatorSize );
}
m_pPushButton->move( qRect.topLeft() );
@@ -876,7 +876,7 @@ QPushButton *WidgetPainter::pushButton( const Rectangle& rControlRegion,
QRadioButton *WidgetPainter::radioButton( const Rectangle& rControlRegion )
{
if ( !m_pRadioButton )
- m_pRadioButton = new QRadioButton( NULL, "radio_button" );
+ m_pRadioButton = new QRadioButton( NULL, "radio_button" );
QRect qRect = region2QRect( rControlRegion );
@@ -885,15 +885,15 @@ QRadioButton *WidgetPainter::radioButton( const Rectangle& rControlRegion )
const char *pStyleName = kapp->style().className();
if ( strcmp( "KThemeStyle", pStyleName ) == 0 )
{
- QRect qOldRect( qRect );
+ QRect qOldRect( qRect );
- qRect.setWidth( kapp->style().pixelMetric(
- QStyle::PM_ExclusiveIndicatorWidth, m_pRadioButton ) );
- qRect.setHeight( kapp->style().pixelMetric(
- QStyle::PM_ExclusiveIndicatorHeight, m_pRadioButton ) );
+ qRect.setWidth( kapp->style().pixelMetric(
+ QStyle::PM_ExclusiveIndicatorWidth, m_pRadioButton ) );
+ qRect.setHeight( kapp->style().pixelMetric(
+ QStyle::PM_ExclusiveIndicatorHeight, m_pRadioButton ) );
- qRect.moveBy( ( qOldRect.width() - qRect.width() ) / 2,
- ( qOldRect.height() - qRect.height() ) / 2 );
+ qRect.moveBy( ( qOldRect.width() - qRect.width() ) / 2,
+ ( qOldRect.height() - qRect.height() ) / 2 );
}
m_pRadioButton->move( qRect.topLeft() );
@@ -905,7 +905,7 @@ QRadioButton *WidgetPainter::radioButton( const Rectangle& rControlRegion )
QCheckBox *WidgetPainter::checkBox( const Rectangle& rControlRegion )
{
if ( !m_pCheckBox )
- m_pCheckBox = new QCheckBox( NULL, "check_box" );
+ m_pCheckBox = new QCheckBox( NULL, "check_box" );
QRect qRect = region2QRect( rControlRegion );
@@ -914,15 +914,15 @@ QCheckBox *WidgetPainter::checkBox( const Rectangle& rControlRegion )
const char *pStyleName = kapp->style().className();
if ( strcmp( "KThemeStyle", pStyleName ) == 0 )
{
- QRect qOldRect( qRect );
+ QRect qOldRect( qRect );
- qRect.setWidth( kapp->style().pixelMetric(
- QStyle::PM_IndicatorWidth, m_pCheckBox ) );
- qRect.setHeight( kapp->style().pixelMetric(
- QStyle::PM_IndicatorHeight, m_pCheckBox ) );
+ qRect.setWidth( kapp->style().pixelMetric(
+ QStyle::PM_IndicatorWidth, m_pCheckBox ) );
+ qRect.setHeight( kapp->style().pixelMetric(
+ QStyle::PM_IndicatorHeight, m_pCheckBox ) );
- qRect.moveBy( ( qOldRect.width() - qRect.width() ) / 2,
- ( qOldRect.height() - qRect.height() ) / 2 );
+ qRect.moveBy( ( qOldRect.width() - qRect.width() ) / 2,
+ ( qOldRect.height() - qRect.height() ) / 2 );
}
m_pCheckBox->move( qRect.topLeft() );
@@ -937,15 +937,15 @@ QComboBox *WidgetPainter::comboBox( const Rectangle& rControlRegion,
QComboBox *pComboBox = NULL;
if ( bEditable )
{
- if ( !m_pEditableComboBox )
- m_pEditableComboBox = new QComboBox( true, NULL, "combo_box_edit" );
- pComboBox = m_pEditableComboBox;
+ if ( !m_pEditableComboBox )
+ m_pEditableComboBox = new QComboBox( true, NULL, "combo_box_edit" );
+ pComboBox = m_pEditableComboBox;
}
else
{
- if ( !m_pComboBox )
- m_pComboBox = new QComboBox( false, NULL, "combo_box" );
- pComboBox = m_pComboBox;
+ if ( !m_pComboBox )
+ m_pComboBox = new QComboBox( false, NULL, "combo_box" );
+ pComboBox = m_pComboBox;
}
QRect qRect = region2QRect( rControlRegion );
@@ -959,7 +959,7 @@ QComboBox *WidgetPainter::comboBox( const Rectangle& rControlRegion,
QLineEdit *WidgetPainter::lineEdit( const Rectangle& rControlRegion )
{
if ( !m_pLineEdit )
- m_pLineEdit = new QLineEdit( NULL, "line_edit" );
+ m_pLineEdit = new QLineEdit( NULL, "line_edit" );
QRect qRect = region2QRect( rControlRegion );
@@ -973,10 +973,9 @@ QSpinWidget *WidgetPainter::spinWidget( const Rectangle& rControlRegion )
{
if ( !m_pSpinWidget )
{
- m_pSpinWidget = new QSpinWidget( NULL, "spin_widget" );
-
- m_pSpinEdit = new QLineEdit( NULL, "line_edit_spin" );
- m_pSpinWidget->setEditWidget( m_pSpinEdit );
+ m_pSpinWidget = new QSpinWidget( NULL, "spin_widget" );
+ m_pSpinEdit = new QLineEdit( NULL, "line_edit_spin" );
+ m_pSpinWidget->setEditWidget( m_pSpinEdit );
}
QRect qRect = region2QRect( rControlRegion );
@@ -992,19 +991,19 @@ QTabBar *WidgetPainter::tabBar( const Rectangle& rControlRegion )
{
if ( !m_pTabBar )
{
- if ( !m_pTabBarParent )
- m_pTabBarParent = new QWidget( NULL, "tab_bar_parent" );
+ if ( !m_pTabBarParent )
+ m_pTabBarParent = new QWidget( NULL, "tab_bar_parent" );
- m_pTabBar = new QTabBar( m_pTabBarParent, "tab_bar" );
+ m_pTabBar = new QTabBar( m_pTabBarParent, "tab_bar" );
- m_pTabLeft = new QTab();
- m_pTabMiddle = new QTab();
- m_pTabRight = new QTab();
- m_pTabAlone = new QTab();
+ m_pTabLeft = new QTab();
+ m_pTabMiddle = new QTab();
+ m_pTabRight = new QTab();
+ m_pTabAlone = new QTab();
- m_pTabBar->addTab( m_pTabLeft );
- m_pTabBar->addTab( m_pTabMiddle );
- m_pTabBar->addTab( m_pTabRight );
+ m_pTabBar->addTab( m_pTabLeft );
+ m_pTabBar->addTab( m_pTabMiddle );
+ m_pTabBar->addTab( m_pTabRight );
}
QRect qRect = region2QRect( rControlRegion );
@@ -1020,7 +1019,7 @@ QTabBar *WidgetPainter::tabBar( const Rectangle& rControlRegion )
QTabWidget *WidgetPainter::tabWidget( const Rectangle& rControlRegion )
{
if ( !m_pTabWidget )
- m_pTabWidget = new QTabWidget( NULL, "tab_widget" );
+ m_pTabWidget = new QTabWidget( NULL, "tab_widget" );
QRect qRect = region2QRect( rControlRegion );
--qRect.rTop();
@@ -1034,7 +1033,7 @@ QTabWidget *WidgetPainter::tabWidget( const Rectangle& rControlRegion )
QListView *WidgetPainter::listView( const Rectangle& rControlRegion )
{
if ( !m_pListView )
- m_pListView = new QListView( NULL, "list_view" );
+ m_pListView = new QListView( NULL, "list_view" );
QRect qRect = region2QRect( rControlRegion );
@@ -1049,9 +1048,9 @@ QScrollBar *WidgetPainter::scrollBar( const Rectangle& rControlRegion,
{
if ( !m_pScrollBar )
{
- m_pScrollBar = new QScrollBar( NULL, "scroll_bar" );
- m_pScrollBar->setTracking( false );
- m_pScrollBar->setLineStep( 1 );
+ m_pScrollBar = new QScrollBar( NULL, "scroll_bar" );
+ m_pScrollBar->setTracking( false );
+ m_pScrollBar->setLineStep( 1 );
}
QRect qRect = region2QRect( rControlRegion );
@@ -1063,10 +1062,10 @@ QScrollBar *WidgetPainter::scrollBar( const Rectangle& rControlRegion,
const ScrollbarValue *pValue = static_cast<const ScrollbarValue *> ( &aValue );
if ( pValue )
{
- m_pScrollBar->setMinValue( pValue->mnMin );
- m_pScrollBar->setMaxValue( pValue->mnMax - pValue->mnVisibleSize );
- m_pScrollBar->setValue( pValue->mnCur );
- m_pScrollBar->setPageStep( pValue->mnVisibleSize );
+ m_pScrollBar->setMinValue( pValue->mnMin );
+ m_pScrollBar->setMaxValue( pValue->mnMax - pValue->mnVisibleSize );
+ m_pScrollBar->setValue( pValue->mnCur );
+ m_pScrollBar->setPageStep( pValue->mnVisibleSize );
}
return m_pScrollBar;
More information about the Libreoffice-commits
mailing list