[Libreoffice-commits] .: 2 commits - sfx2/source

Michael Meeks michael at kemper.freedesktop.org
Mon Mar 5 12:54:36 PST 2012


 sfx2/source/dialog/dinfdlg.cxx |  245 +++++++++++++++++++----------------------
 1 file changed, 116 insertions(+), 129 deletions(-)

New commits:
commit 8a997fd7e0e034e27219ce67d73f8195e95a4716
Author: William Gathoye <william at gathoye.be>
Date:   Mon Mar 5 20:50:56 2012 +0000

    Fix indentation

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 874e455..2b4e06d 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -26,7 +26,6 @@
  *
  ************************************************************************/
 
-
 #include <tools/urlobj.hxx>
 #include <vcl/msgbox.hxx>
 #include <svl/eitem.hxx>
@@ -85,7 +84,6 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::ui::dialogs;
 using namespace ::com::sun::star::uno;
 
-
 struct CustomProperty
 {
     ::rtl::OUString             m_sName;
@@ -99,7 +97,6 @@ struct CustomProperty
     { return m_sName.equals( rProp.m_sName ) && m_aValue == rProp.m_aValue; }
 };
 
-
 static
 bool operator==(const util::DateTime &i_rLeft, const util::DateTime &i_rRight)
 {
@@ -113,7 +110,6 @@ bool operator==(const util::DateTime &i_rLeft, const util::DateTime &i_rRight)
 }
 
 // STATIC DATA -----------------------------------------------------------
-
 TYPEINIT1_AUTOFACTORY(SfxDocumentInfoItem, SfxStringItem);
 
 const sal_uInt16 HI_NAME = 1;
@@ -121,7 +117,7 @@ const sal_uInt16 HI_TYPE = 2;
 const sal_uInt16 HI_VALUE = 3;
 const sal_uInt16 HI_ACTION = 4;
 
-static const char DOCUMENT_SIGNATURE_MENU_CMD[]      = "Signature";
+static const char DOCUMENT_SIGNATURE_MENU_CMD[] = "Signature";
 
 //------------------------------------------------------------------------
 String CreateSizeText( sal_uIntPtr nSize, sal_Bool bExtraBytes = sal_True, sal_Bool bSmartExtraBytes = sal_False );
@@ -326,28 +322,23 @@ SfxDocumentInfoItem::SfxDocumentInfoItem( const SfxDocumentInfoItem& rItem )
 }
 
 //------------------------------------------------------------------------
-
 SfxDocumentInfoItem::~SfxDocumentInfoItem()
 {
     ClearCustomProperties();
 }
 
 //------------------------------------------------------------------------
-
 SfxPoolItem* SfxDocumentInfoItem::Clone( SfxItemPool * ) const
 {
     return new SfxDocumentInfoItem( *this );
 }
 
 //------------------------------------------------------------------------
-
 int SfxDocumentInfoItem::operator==( const SfxPoolItem& rItem) const
 {
-    if (!(rItem.Type() == Type() && SfxStringItem::operator==(rItem))) {
+    if (!(rItem.Type() == Type() && SfxStringItem::operator==(rItem)))
         return false;
-    }
-    const SfxDocumentInfoItem& rInfoItem(
-        static_cast<const SfxDocumentInfoItem&>(rItem));
+    const SfxDocumentInfoItem& rInfoItem(static_cast<const SfxDocumentInfoItem&>(rItem));
 
     return
          m_AutoloadDelay        == rInfoItem.m_AutoloadDelay     &&
@@ -372,7 +363,6 @@ int SfxDocumentInfoItem::operator==( const SfxPoolItem& rItem) const
 }
 
 //------------------------------------------------------------------------
-
 void SfxDocumentInfoItem::resetUserData(const ::rtl::OUString & i_rAuthor)
 {
     setAuthor(i_rAuthor);
@@ -389,7 +379,6 @@ void SfxDocumentInfoItem::resetUserData(const ::rtl::OUString & i_rAuthor)
 }
 
 //------------------------------------------------------------------------
-
 void SfxDocumentInfoItem::UpdateDocumentInfo(
         const uno::Reference<document::XDocumentProperties>& i_xDocProps,
         bool i_bDoNotUpdateUserDefined) const
@@ -462,7 +451,6 @@ void SfxDocumentInfoItem::UpdateDocumentInfo(
 }
 
 //------------------------------------------------------------------------
-
 sal_Bool SfxDocumentInfoItem::IsDeleteUserData() const
 {
     return m_bDeleteUserData;
@@ -639,7 +627,6 @@ bool SfxDocumentInfoItem::PutValue( const Any& rVal, sal_uInt8 nMemberId )
 }
 
 //------------------------------------------------------------------------
-
 SfxDocumentDescPage::SfxDocumentDescPage( Window * pParent, const SfxItemSet& rItemSet )  :
 
     SfxTabPage( pParent, SfxResId( TP_DOCINFODESC ), rItemSet ),
@@ -660,14 +647,12 @@ SfxDocumentDescPage::SfxDocumentDescPage( Window * pParent, const SfxItemSet& rI
 }
 
 //------------------------------------------------------------------------
-
 SfxTabPage *SfxDocumentDescPage::Create(Window *pParent, const SfxItemSet &rItemSet)
 {
      return new SfxDocumentDescPage(pParent, rItemSet);
 }
 
 //------------------------------------------------------------------------
-
 sal_Bool SfxDocumentDescPage::FillItemSet(SfxItemSet &rSet)
 {
     // Test whether a change is present
@@ -675,7 +660,7 @@ sal_Bool SfxDocumentDescPage::FillItemSet(SfxItemSet &rSet)
     const sal_Bool bThemeMod = aThemaEd.IsModified();
     const sal_Bool bKeywordsMod = aKeywordsEd.IsModified();
     const sal_Bool bCommentMod = aCommentEd.IsModified();
-    if( !( bTitleMod || bThemeMod || bKeywordsMod || bCommentMod ) )
+    if ( !( bTitleMod || bThemeMod || bKeywordsMod || bCommentMod ) )
     {
         return sal_False;
     }
@@ -700,24 +685,24 @@ sal_Bool SfxDocumentDescPage::FillItemSet(SfxItemSet &rSet)
         return sal_False;
     }
 
-    if( bTitleMod )
+    if ( bTitleMod )
     {
         pInfo->setTitle( aTitleEd.GetText() );
     }
-    if( bThemeMod )
+    if ( bThemeMod )
     {
         pInfo->setSubject( aThemaEd.GetText() );
     }
-    if( bKeywordsMod )
+    if ( bKeywordsMod )
     {
         pInfo->setKeywords( aKeywordsEd.GetText() );
     }
-    if( bCommentMod )
+    if ( bCommentMod )
     {
         pInfo->setDescription( aCommentEd.GetText() );
     }
     rSet.Put( SfxDocumentInfoItem( *pInfo ) );
-    if( pInfo != pInfoItem )
+    if ( pInfo != pInfoItem )
     {
         delete pInfo;
     }
@@ -726,19 +711,18 @@ sal_Bool SfxDocumentDescPage::FillItemSet(SfxItemSet &rSet)
 }
 
 //------------------------------------------------------------------------
-
 void SfxDocumentDescPage::Reset(const SfxItemSet &rSet)
 {
-     pInfoItem = &(SfxDocumentInfoItem &)rSet.Get(SID_DOCINFO);
+    pInfoItem = &(SfxDocumentInfoItem &)rSet.Get(SID_DOCINFO);
 
-     aTitleEd.SetText( pInfoItem->getTitle() );
-     aThemaEd.SetText( pInfoItem->getSubject() );
-     aKeywordsEd.SetText( pInfoItem->getKeywords() );
-     aCommentEd.SetText( pInfoItem->getDescription() );
+    aTitleEd.SetText( pInfoItem->getTitle() );
+    aThemaEd.SetText( pInfoItem->getSubject() );
+    aKeywordsEd.SetText( pInfoItem->getKeywords() );
+    aCommentEd.SetText( pInfoItem->getDescription() );
 
-     SFX_ITEMSET_ARG( &rSet, pROItem, SfxBoolItem, SID_DOC_READONLY, sal_False );
-     if ( pROItem && pROItem->GetValue() )
-     {
+    SFX_ITEMSET_ARG( &rSet, pROItem, SfxBoolItem, SID_DOC_READONLY, sal_False );
+    if ( pROItem && pROItem->GetValue() )
+    {
         aTitleEd.SetReadOnly( sal_True );
         aThemaEd.SetReadOnly( sal_True );
         aKeywordsEd.SetReadOnly( sal_True );
@@ -747,7 +731,6 @@ void SfxDocumentDescPage::Reset(const SfxItemSet &rSet)
 }
 
 //------------------------------------------------------------------------
-
 namespace
 {
     String GetDateTimeString( sal_Int32 _nDate, sal_Int32 _nTime )
@@ -765,13 +748,13 @@ namespace
     // copy from xmlsecurity/source/dialog/resourcemanager.cxx
     String GetContentPart( const String& _rRawString, const String& _rPartId )
     {
-        String      s;
+        String s;
 
         xub_StrLen  nContStart = _rRawString.Search( _rPartId );
-        if( nContStart != STRING_NOTFOUND )
+        if ( nContStart != STRING_NOTFOUND )
         {
             nContStart = nContStart + _rPartId.Len();
-            ++nContStart;                   // now it's start of content, directly after Id
+            ++nContStart; // now it's start of content, directly after Id
 
             xub_StrLen  nContEnd = _rRawString.Search( sal_Unicode( ',' ), nContStart );
 
@@ -780,7 +763,6 @@ namespace
 
         return s;
     }
-
 }
 
 SfxDocumentPage::SfxDocumentPage( Window* pParent, const SfxItemSet& rItemSet ) :
@@ -943,13 +925,12 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl)
     {
         if (!pShell)
             break;
-
         SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet();
         if (!pMedSet)
             break;
         const SfxFilter* pFilter = pShell->GetMedium()->GetFilter();
         if (!pFilter)
-             break;
+            break;
 
         rtl::OUString aDocName;
         sfx2::RequestPassword(pFilter, aDocName, pMedSet);
@@ -962,7 +943,7 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl)
 void SfxDocumentPage::ImplUpdateSignatures()
 {
     SfxObjectShell* pDoc = SfxObjectShell::Current();
-    if( pDoc )
+    if ( pDoc )
     {
         SfxMedium* pMedium = pDoc->GetMedium();
         if ( pMedium && pMedium->GetName().Len() && pMedium->GetStorage().is() )
@@ -970,17 +951,15 @@ void SfxDocumentPage::ImplUpdateSignatures()
             Reference< security::XDocumentDigitalSignatures > xD(
                 comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.security.DocumentDigitalSignatures" ) ) ), uno::UNO_QUERY );
 
-            if( xD.is() )
+            if ( xD.is() )
             {
                 String s;
                 Sequence< security::DocumentSignatureInformation > aInfos;
                 aInfos = xD->verifyDocumentContentSignatures( pMedium->GetZipStorageToSign_Impl(),
                                                                 uno::Reference< io::XInputStream >() );
-                if( aInfos.getLength() > 1 )
-                {
+                if ( aInfos.getLength() > 1 )
                     s = aMultiSignedStr;
-                }
-                else if( aInfos.getLength() == 1 )
+                else if ( aInfos.getLength() == 1 )
                 {
                     String aCN_Id( String::CreateFromAscii( "CN" ) );
                     const security::DocumentSignatureInformation& rInfo = aInfos[ 0 ];
@@ -1001,11 +980,9 @@ void SfxDocumentPage::ImplCheckPasswordState()
     {
         if (!pShell)
             break;
-
         SfxItemSet* pMedSet = pShell->GetMedium()->GetItemSet();
         if (!pMedSet)
             break;
-
         SFX_ITEMSET_ARG( pMedSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False);
         uno::Sequence< beans::NamedValue > aEncryptionData;
         if (pEncryptionDataItem)
@@ -1107,9 +1084,7 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet )
 
     // template data
     if ( pInfoItem->HasTemplate() )
-    {
         aTemplValFt.SetText( pInfoItem->getTemplateName() );
-    }
     else
     {
         aTemplFt.Hide();
@@ -1220,7 +1195,6 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet )
 }
 
 //------------------------------------------------------------------------
-
 SfxInternetPage::SfxInternetPage( Window* pParent, const SfxItemSet& rItemSet ) :
 
     SfxTabPage( pParent, SfxResId( TP_DOCINFORELOAD ), rItemSet ),
@@ -1231,8 +1205,8 @@ SfxInternetPage::SfxInternetPage( Window* pParent, const SfxItemSet& rItemSet )
 
     aRBForwardUpdate    ( this, SfxResId( RB_FORWARDUPDATE      ) ),
     aFTEvery            ( this, SfxResId( FT_EVERY              ) ),
-    aNFReload           ( this, SfxResId( ED_RELOAD         ) ),
-    aFTReloadSeconds    ( this, SfxResId( FT_RELOADSECS     ) ),
+    aNFReload           ( this, SfxResId( ED_RELOAD             ) ),
+    aFTReloadSeconds    ( this, SfxResId( FT_RELOADSECS         ) ),
     aFTAfter            ( this, SfxResId( FT_AFTER              ) ),
     aNFAfter            ( this, SfxResId( ED_FORWARD            ) ),
     aFTAfterSeconds     ( this, SfxResId( FT_FORWARDSECS        ) ),
@@ -1252,15 +1226,15 @@ SfxInternetPage::SfxInternetPage( Window* pParent, const SfxItemSet& rItemSet )
     pInfoItem = &( SfxDocumentInfoItem& ) rItemSet.Get( SID_DOCINFO );
     TargetList          aList;
     SfxViewFrame*       pFrame = SfxViewFrame::Current();
-    if( pFrame )
+    if ( pFrame )
     {
         pFrame = pFrame->GetTopViewFrame();
-        if( pFrame )
+        if ( pFrame )
         {
             pFrame->GetTargetList( aList );
 
             String* pObj;
-            for( size_t nPos = aList.size() ; nPos ; )
+            for ( size_t nPos = aList.size() ; nPos ; )
             {
                 pObj = aList[ --nPos ];
                 aCBFrame.InsertEntry( *pObj );
@@ -1280,22 +1254,20 @@ SfxInternetPage::SfxInternetPage( Window* pParent, const SfxItemSet& rItemSet )
 }
 
 //------------------------------------------------------------------------
-
 SfxInternetPage::~SfxInternetPage()
 {
     delete pFileDlg;
 }
 
 //------------------------------------------------------------------------
-
 void SfxInternetPage::ChangeState( STATE eNewState )
 {
     DBG_ASSERT( eNewState != S_Init, "*SfxInternetPage::ChangeState(): new state init is supposed to not work here!" );
 
-    if( eState == eNewState  )
+    if ( eState == eNewState  )
         return;
 
-    switch( eState )
+    switch ( eState )
     {
         case S_Init:
             EnableNoUpdate( sal_True );
@@ -1334,7 +1306,7 @@ void SfxInternetPage::ChangeState( STATE eNewState )
 
 void SfxInternetPage::EnableNoUpdate( sal_Bool bEnable )
 {
-    if( bEnable )
+    if ( bEnable )
         aRBNoAutoUpdate.Check();
 }
 
@@ -1346,7 +1318,7 @@ void SfxInternetPage::EnableReload( sal_Bool bEnable )
     aNFReload.Enable( bEnable );
     aFTReloadSeconds.Enable( bEnable );
 
-    if( bEnable )
+    if ( bEnable )
         aRBReloadUpdate.Check();
 }
 
@@ -1363,7 +1335,7 @@ void SfxInternetPage::EnableForward( sal_Bool bEnable )
     aFTFrame.Enable( bEnable );
     aCBFrame.Enable( bEnable );
 
-    if( bEnable )
+    if ( bEnable )
         aRBForwardUpdate.Check();
 }
 
@@ -1428,10 +1400,10 @@ sal_Bool SfxInternetPage::FillItemSet( SfxItemSet& rSet )
     SfxTabDialog*               pDlg = GetTabDialog();
     const SfxItemSet*           pExSet = NULL;
 
-    if( pDlg )
+    if ( pDlg )
         pExSet = pDlg->GetExampleSet();
 
-    if( pExSet && SFX_ITEM_SET != pExSet->GetItemState( SID_DOCINFO, sal_True, &pItem ) )
+    if ( pExSet && SFX_ITEM_SET != pExSet->GetItemState( SID_DOCINFO, sal_True, &pItem ) )
         pInfo = pInfoItem;
     else if ( pItem )
         pInfo = new SfxDocumentInfoItem( *(const SfxDocumentInfoItem*)pItem );
@@ -1451,7 +1423,7 @@ sal_Bool SfxInternetPage::FillItemSet( SfxItemSet& rSet )
     SAL_WNODEPRECATED_DECLARATIONS_POP
     sal_uIntPtr                     nDelay = 0;
 
-    switch( eState )
+    switch ( eState )
     {
         case S_NoUpdate:
             break;
@@ -1473,13 +1445,13 @@ sal_Bool SfxInternetPage::FillItemSet( SfxItemSet& rSet )
             SAL_WNODEPRECATED_DECLARATIONS_POP
             nDelay = static_cast<sal_uIntPtr>(aNFAfter.GetValue());
             break;
-              default:
-                  break;
+        default:
+            break;
     }
 
     pInfo->setAutoloadEnabled( bEnableReload );
 
-    if( bEnableReload )
+    if ( bEnableReload )
     {
         pInfo->setAutoloadURL( *aURL.get() );
         pInfo->setDefaultTarget( *aFrame.get() );
@@ -1487,20 +1459,18 @@ sal_Bool SfxInternetPage::FillItemSet( SfxItemSet& rSet )
     }
 
     rSet.Put( *pInfo );
-    if( pInfo != pInfoItem )
+    if ( pInfo != pInfoItem )
         delete pInfo;
     return sal_True;
 }
 
 //------------------------------------------------------------------------
-
 SfxTabPage *SfxInternetPage::Create( Window* pParent, const SfxItemSet& rItemSet )
 {
     return new SfxInternetPage(pParent, rItemSet);
 }
 
 //------------------------------------------------------------------------
-
 void SfxInternetPage::Reset( const SfxItemSet& rSet )
 {
     pInfoItem = &( SfxDocumentInfoItem& ) rSet.Get( SID_DOCINFO );
@@ -1509,9 +1479,9 @@ void SfxInternetPage::Reset( const SfxItemSet& rSet )
     if ( pURLItem )
         aBaseURL = pURLItem->GetValue();
 
-    STATE               eNewState = S_NoUpdate;
+    STATE eNewState = S_NoUpdate;
 
-    if( pInfoItem->isAutoloadEnabled() )
+    if ( pInfoItem->isAutoloadEnabled() )
     {
         const String&   rURL = pInfoItem->getAutoloadURL();
 
@@ -1552,14 +1522,13 @@ void SfxInternetPage::Reset( const SfxItemSet& rSet )
 }
 
 //------------------------------------------------------------------------
-
 int SfxInternetPage::DeactivatePage( SfxItemSet* /*pSet*/ )
 {
-    int             nRet = LEAVE_PAGE;
+    int nRet = LEAVE_PAGE;
 
-    if( eState == S_Forward && !aEDForwardURL.GetText().Len() )
+    if ( eState == S_Forward && !aEDForwardURL.GetText().Len() )
     {
-        ErrorBox    aErrBox( this, WB_OK, aForwardErrorMessg );
+        ErrorBox aErrBox( this, WB_OK, aForwardErrorMessg );
         aErrBox.Execute();
 
         nRet = KEEP_PAGE;
@@ -1569,7 +1538,6 @@ int SfxInternetPage::DeactivatePage( SfxItemSet* /*pSet*/ )
 }
 
 //------------------------------------------------------------------------
-
 SfxDocumentInfoDialog::SfxDocumentInfoDialog( Window* pParent,
                                               const SfxItemSet& rItemSet ) :
 
@@ -1745,11 +1713,11 @@ CustomPropertiesDurationField::~CustomPropertiesDurationField()
 
 void CustomPropertiesDurationField::RequestHelp( const HelpEvent& rHEvt )
 {
-    if( rHEvt.GetMode() & HELPMODE_QUICK )
+    if ( rHEvt.GetMode() & HELPMODE_QUICK )
     {
         Size aSize( GetSizePixel() );
         Rectangle aItemRect( rHEvt.GetMousePosPixel(), aSize );
-        if(Help::IsBalloonHelpEnabled())
+        if (Help::IsBalloonHelpEnabled())
             Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), GetText() );
         else
             Help::ShowQuickHelp( this, aItemRect, GetText(),
@@ -1784,7 +1752,7 @@ CustomPropertiesEditButton::~CustomPropertiesEditButton()
 IMPL_LINK_NOARG(CustomPropertiesEditButton, ClickHdl)
 {
     DurationDialog_Impl* pDurationDlg = new DurationDialog_Impl( this, m_pLine->m_aDurationField.GetDuration() );
-    if( RET_OK == pDurationDlg->Execute() )
+    if ( RET_OK == pDurationDlg->Execute() )
         m_pLine->m_aDurationField.SetDuration( pDurationDlg->GetDuration() );
     delete pDurationDlg;
     return 1;
@@ -1805,7 +1773,6 @@ void CustomPropertiesYesNoButton::Resize()
 }
 
 // struct CustomPropertyLine ---------------------------------------------
-
 CustomPropertyLine::CustomPropertyLine( Window* pParent ) :
     m_aNameBox      ( pParent, SfxResId( SFX_CB_PROPERTY_NAME ) ),
     m_aTypeBox      ( pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this ),
@@ -1843,7 +1810,6 @@ void CustomPropertyLine::SetRemoved()
 }
 
 // class CustomPropertiesWindow ------------------------------------------
-
 CustomPropertiesWindow::CustomPropertiesWindow( Window* pParent, const ResId& rResId ) :
 
     Window( pParent, rResId ),
@@ -1890,11 +1856,9 @@ IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox )
     pLine->m_aEditButton.Show( CUSTOM_TYPE_DURATION == nType );
     pLine->m_aYesNoButton.Show( CUSTOM_TYPE_BOOLEAN == nType );
     //adjust positions of date and time controls
-    if( nType == CUSTOM_TYPE_DATE )
-    {
+    if ( nType == CUSTOM_TYPE_DATE )
         pLine->m_aDateField.SetPosSizePixel(pLine->m_aValueEdit.GetPosPixel(), pLine->m_aValueEdit.GetSizePixel());
-    }
-    else if( nType == CUSTOM_TYPE_DATETIME)
+    else if ( nType == CUSTOM_TYPE_DATETIME)
     {
         pLine->m_aDateField.SetPosSizePixel( pLine->m_aDatePos, pLine->m_aDateTimeSize );
         pLine->m_aTimeField.SetPosSizePixel(pLine->m_aTimePos, pLine->m_aDateTimeSize );
@@ -2334,7 +2298,6 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
 }
 
 // class CustomPropertiesControl -----------------------------------------
-
 CustomPropertiesControl::CustomPropertiesControl( Window* pParent, const ResId& rResId ) :
 
     Control( pParent, rResId ),
@@ -2413,7 +2376,6 @@ void CustomPropertiesControl::AddLine( const ::rtl::OUString& sName, Any& rAny,
 }
 
 // class SfxCustomPropertiesPage -----------------------------------------
-
 SfxCustomPropertiesPage::SfxCustomPropertiesPage( Window* pParent, const SfxItemSet& rItemSet ) :
 
     SfxTabPage( pParent, SfxResId( TP_CUSTOMPROPERTIES ), rItemSet ),
@@ -2437,13 +2399,13 @@ IMPL_LINK_NOARG(SfxCustomPropertiesPage, AddHdl)
 sal_Bool SfxCustomPropertiesPage::FillItemSet( SfxItemSet& rSet )
 {
     sal_Bool bModified = sal_False;
-    const SfxPoolItem*      pItem = NULL;
-    SfxDocumentInfoItem*    pInfo = NULL;
-    bool                    bMustDelete = false;
+    const SfxPoolItem* pItem = NULL;
+    SfxDocumentInfoItem* pInfo = NULL;
+    bool bMustDelete = false;
 
     if ( GetTabDialog() && GetTabDialog()->GetExampleSet() )
     {
-        if( SFX_ITEM_SET !=
+        if ( SFX_ITEM_SET !=
                 GetTabDialog()->GetExampleSet()->GetItemState( SID_DOCINFO, sal_True, &pItem ) )
             pInfo = &( SfxDocumentInfoItem& )rSet.Get( SID_DOCINFO );
         else
commit 21d85dabe5d780571ad8ca39c8e6d30be90a0bf4
Author: William Gathoye <william at gathoye.be>
Date:   Tue Feb 28 11:55:29 2012 +0100

    Fix controls size and position on the document information dialog

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 8d9a3b0..874e455 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -828,46 +828,71 @@ SfxDocumentPage::SfxDocumentPage( Window* pParent, const SfxItemSet& rItemSet )
     bHandleDelete       ( sal_False )
 
 {
-    aNameED.SetAccessibleName(String(SfxResId(EDIT_FILE_NAME)));
+    aNameED.SetAccessibleName( String( SfxResId( EDIT_FILE_NAME ) ) );
     FreeResource();
-
     ImplUpdateSignatures();
     ImplCheckPasswordState();
-    aDeleteBtn.SetClickHdl( LINK( this, SfxDocumentPage, DeleteHdl ) );
-    aSignatureBtn.SetClickHdl( LINK( this, SfxDocumentPage, SignatureHdl ) );
     aChangePassBtn.SetClickHdl( LINK( this, SfxDocumentPage, ChangePassHdl ) );
+    aSignatureBtn.SetClickHdl( LINK( this, SfxDocumentPage, SignatureHdl ) );
+    aDeleteBtn.SetClickHdl( LINK( this, SfxDocumentPage, DeleteHdl ) );
 
-    // if the button text is too wide, then broaden it
-    const long nOffset = 12;
-    String sText = aSignatureBtn.GetText();
-    long nTxtW = aSignatureBtn.GetTextWidth( sText );
-    if ( sText.Search( '~' ) == STRING_NOTFOUND )
-        nTxtW += nOffset;
-    long nBtnW = aSignatureBtn.GetSizePixel().Width();
-    if ( nTxtW >= nBtnW )
-    {
-        long nDelta = Max( nTxtW - nBtnW, nOffset/3 );
-        Size aNewSize = aSignatureBtn.GetSizePixel();
-        aNewSize.Width() += nDelta;
-        aSignatureBtn.SetSizePixel( aNewSize );
-        aDeleteBtn.SetSizePixel( aNewSize );
-        // and give them a new position
-        Point aNewPos = aSignatureBtn.GetPosPixel();
-        aNewPos.X() -= nDelta;
-        aSignatureBtn.SetPosPixel( aNewPos );
-        aNewPos = aDeleteBtn.GetPosPixel();
-        aNewPos.X() -= nDelta;
-        aDeleteBtn.SetPosPixel( aNewPos );
-
-        aNewSize = aSignedValFt.GetSizePixel();
-        aNewSize.Width() -= nDelta;
-        aSignedValFt.SetSizePixel( aNewSize );
-        aNewSize = aUseUserDataCB.GetSizePixel();
-        aNewSize.Width() -= nDelta;
-        aUseUserDataCB.SetSizePixel( aNewSize );
-    }
-    // See i96288
-    // Check if the document signature command is enabled
+    // Get the max size needed for the 'Change Password', 'Signature' and 'Delete' buttons
+    // and set their size according to this max size to get perfect aligment
+    long nTxtW = ( aChangePassBtn.GetTextWidth( aChangePassBtn.GetText() ) + IMPL_EXTRA_BUTTON_WIDTH );
+    nTxtW = Max( ( aSignatureBtn.GetTextWidth( aSignatureBtn.GetText() ) + IMPL_EXTRA_BUTTON_WIDTH ), nTxtW);
+    nTxtW = Max( ( aDeleteBtn.GetTextWidth( aDeleteBtn.GetText() ) + IMPL_EXTRA_BUTTON_WIDTH ), nTxtW);
+
+    // New size and position for the 'Change Password' button
+    Size aNewSize = aChangePassBtn.GetSizePixel();
+    long nDelta = nTxtW - aNewSize.Width();
+    aNewSize.Width() = nTxtW;
+    aChangePassBtn.SetSizePixel( aNewSize );
+    Point aNewPos = aChangePassBtn.GetPosPixel();
+    aNewPos.X() -= nDelta;
+    aChangePassBtn.SetPosPixel( aNewPos );
+
+    // Calculate the space between the bmp image and the 'Change password' button
+    nDelta = aNewPos.X() - IMPL_EXTRA_BUTTON_WIDTH / 2 \
+             - ( aBmp1.GetPosPixel().X() + aBmp1.GetSizePixel().Width() );
+
+    // Reduces the filename field size if space size is not large enough
+    aNewSize = aNameED.GetSizePixel();
+    if ( nDelta - aNewSize.Width() < IMPL_EXTRA_BUTTON_WIDTH )
+    {
+        aNewSize.Width() -= IMPL_EXTRA_BUTTON_WIDTH - ( nDelta - aNewSize.Width() );
+        aNameED.SetSizePixel( aNewSize );
+    }
+
+    // Centers the filename field in the space
+    aNewPos = aNameED.GetPosPixel();
+    nDelta -= aNewSize.Width();
+    aNewPos.X() = aBmp1.GetPosPixel().X() + aBmp1.GetSizePixel().Width() + nDelta / 2;
+    aNameED.SetPosPixel( aNewPos );
+
+    // New size and position for the 'Signature' button
+    aNewSize = aSignatureBtn.GetSizePixel();
+    nDelta = nTxtW - aNewSize.Width();
+    aNewSize.Width() = nTxtW;
+    aSignatureBtn.SetSizePixel( aNewSize );
+    aNewPos = aSignatureBtn.GetPosPixel();
+    aNewPos.X() -= nDelta;
+    aSignatureBtn.SetPosPixel( aNewPos );
+
+    // New size for the signature field
+    aNewSize = aSignedValFt.GetSizePixel();
+    aNewSize.Width() -= nDelta;
+    aSignedValFt.SetSizePixel( aNewSize );
+
+    // New size and position for the 'Delete' button
+    aNewSize = aDeleteBtn.GetSizePixel();
+    nDelta = nTxtW - aNewSize.Width();
+    aNewSize.Width() = nTxtW;
+    aDeleteBtn.SetSizePixel( aNewSize );
+    aNewPos = aDeleteBtn.GetPosPixel();
+    aNewPos.X() -= nDelta;
+    aDeleteBtn.SetPosPixel( aNewPos );
+
+    // [i96288] Check if the document signature command is enabled
     // on the main list enable/disable the pushbutton accordingly
     SvtCommandOptions aCmdOptions;
     if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED,


More information about the Libreoffice-commits mailing list