openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1464066 - in /openoffice/branches/sidebar/main/svx/source/sidebar: line/LinePropertyPanel.cxx line/LinePropertyPanel.hxx possize/PosSizePropertyPanel.cxx
Date Wed, 03 Apr 2013 15:11:55 GMT
Author: alg
Date: Wed Apr  3 15:11:54 2013
New Revision: 1464066

URL: http://svn.apache.org/r1464066
Log:
i121791 Simplified LineStartEnd ListBox preparation, fixed handling of pState in NotifyItemUpdate

Modified:
    openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.hxx
    openoffice/branches/sidebar/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx

Modified: openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.cxx?rev=1464066&r1=1464065&r2=1464066&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.cxx Wed Apr
 3 15:11:54 2013
@@ -93,95 +93,52 @@ namespace {
         return COL_TRANSPARENT;
     }
 
-} // end of anonymous namespace
-
-
-class LineEndLB_LPP : public ListBox
-{
-
-public:
-		 LineEndLB_LPP( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {}
-		 LineEndLB_LPP( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {}
-
-	void Fill( const XLineEndList* pList, bool bStart = true );
-
-	void	Append( XLineEndEntry* pEntry, Bitmap* pBmp = NULL,
-					bool bStart = true );
-	void	Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL,
-					bool bStart = true );
-};
-
-void LineEndLB_LPP::Fill( const XLineEndList* pList, bool bStart )
-{
-	long nCount = pList->Count();
-	XLineEndEntry* pEntry;
-	VirtualDevice aVD;
-	SetUpdateMode( false );
-
-	for( long i = 0; i < nCount; i++ )
-	{
-        pEntry = pList->GetLineEnd( i );
-		Bitmap* pBitmap = const_cast<XLineEndList*>(pList)->CreateBitmapForUI( i );
-		if( pBitmap )
-		{
-			Size aBmpSize( pBitmap->GetSizePixel() );
-			aVD.SetOutputSizePixel( aBmpSize, false );
-			aVD.DrawBitmap( Point(), *pBitmap );
-			InsertEntry( pEntry->GetName(),
-				aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
-					Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) );
-
-			delete pBitmap;
-		}
-		else
-			InsertEntry( pEntry->GetName() );
-	}
-	SetUpdateMode( true );
-}
-
-void LineEndLB_LPP::Append( XLineEndEntry* pEntry, Bitmap* pBmp, bool bStart )
-{
-	if( pBmp )
-	{
-		VirtualDevice aVD;
-		Size aBmpSize( pBmp->GetSizePixel() );
-
-		aVD.SetOutputSizePixel( aBmpSize, false );
-		aVD.DrawBitmap( Point(), *pBmp );
-		InsertEntry( pEntry->GetName(),
-			aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
-				Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) );
-	}
-	else
-		InsertEntry( pEntry->GetName() );
-}
-
-void LineEndLB_LPP::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp, bool bStart
)
-{
-	RemoveEntry( nPos );
+    void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndList&
rList)
+    {
+        const sal_uInt32 nCount(rList.Count());
+        rListBoxStart.SetUpdateMode(false);
+        rListBoxEnd.SetUpdateMode(false);
 
-	if( pBmp )
-	{
-		VirtualDevice aVD;
-		Size aBmpSize( pBmp->GetSizePixel() );
+        for(sal_uInt32 i(0); i < nCount; i++)
+        {
+            XLineEndEntry* pEntry = rList.GetLineEnd(i);
+            const Bitmap* pBitmap = const_cast< XLineEndList& >(rList).CreateBitmapForUI(i);
 
-		aVD.SetOutputSizePixel( aBmpSize, false );
-		aVD.DrawBitmap( Point(), *pBmp );
-		InsertEntry( pEntry->GetName(),
-			aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
-				Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ), nPos );
-	}
-	else
-		InsertEntry( pEntry->GetName(), nPos );
-}
+            if(pBitmap)
+            {
+                Bitmap aCopyStart(*pBitmap);
+                Bitmap aCopyEnd(*pBitmap);
+                delete pBitmap;
+                const Size aBmpSize(aCopyStart.GetSizePixel());
+                const Rectangle aCropRectStart(Point(), Size(aBmpSize.Width() / 2, aBmpSize.Height()));
+                const Rectangle aCropRectEnd(Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width()
/ 2, aBmpSize.Height()));
+
+                aCopyStart.Crop(aCropRectStart);
+                rListBoxStart.InsertEntry(
+                    pEntry->GetName(),
+                    aCopyStart);
+
+                aCopyEnd.Crop(aCropRectEnd);
+                rListBoxEnd.InsertEntry(
+                    pEntry->GetName(),
+                    aCopyEnd);
+            }
+            else
+            {
+                rListBoxStart.InsertEntry(pEntry->GetName());
+                rListBoxEnd.InsertEntry(pEntry->GetName());
+            }
+        }
 
+        rListBoxStart.SetUpdateMode(true);
+        rListBoxEnd.SetUpdateMode(true);
+    }
+} // end of anonymous namespace
 
 // namespace open
 
 namespace svx { namespace sidebar {
 
-
-
 LinePropertyPanel::LinePropertyPanel(
     Window* pParent,
     const cssu::Reference<css::frame::XFrame>& rxFrame,
@@ -201,22 +158,22 @@ LinePropertyPanel::LinePropertyPanel(
     mpFTTrancparency(new FixedText(this, SVX_RES(FT_TRANSPARENT))),
     mpMFTransparent(new MetricField(this, SVX_RES(MF_TRANSPARENT))),
     mpFTArrow(new FixedText(this, SVX_RES(FT_ARROW))),
-    mpLBStart(new LineEndLB_LPP(this, SVX_RES(LB_START))),
-    mpLBEnd(new LineEndLB_LPP(this, SVX_RES(LB_END))),
+    mpLBStart(new ListBox /*LineEndLB_LPP*/(this, SVX_RES(LB_START))),
+    mpLBEnd(new ListBox /*LineEndLB_LPP*/(this, SVX_RES(LB_END))),
     mpFTEdgeStyle(new FixedText(this, SVX_RES(FT_EDGESTYLE))),
     mpLBEdgeStyle(new ListBox(this, SVX_RES(LB_EDGESTYLE))),
     mpFTCapStyle(new FixedText(this, SVX_RES(FT_CAPSTYLE))),
     mpLBCapStyle(new ListBox(this, SVX_RES(LB_CAPSTYLE))),
-    maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this),             // ( SID_SVX_START
+ 169 )
-    maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this),              // ( SID_SVX_START
+ 170 )
-    maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this),             // ( SID_SVX_START
+ 171 )
-    maColorControl(SID_ATTR_LINE_COLOR, *pBindings, *this),             // ( SID_SVX_START
+ 172 )
-    maStartControl(SID_ATTR_LINE_START, *pBindings, *this),             // ( SID_SVX_START
+ 173 )
-    maEndControl(SID_ATTR_LINE_END, *pBindings, *this),                 // ( SID_SVX_START
+ 174 )
-    maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this),          // ( SID_SVX_START
+ 184 )
-    maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this),      // (SID_SVX_START+1107)
-    maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this),                // (SID_SVX_START+1110)
-    maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this),                   // (SID_SVX_START+1111)
+    maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this),
+    maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this),
+    maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this),
+    maColorControl(SID_ATTR_LINE_COLOR, *pBindings, *this),
+    maStartControl(SID_ATTR_LINE_START, *pBindings, *this),
+    maEndControl(SID_ATTR_LINE_END, *pBindings, *this),
+    maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this),
+    maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this),
+    maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this),
+    maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this),
     maColor(COL_BLACK),
     mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_LINE_COLOR, TBI_COLOR, mpTBColor.get(),
TBX_UPDATER_MODE_CHAR_COLOR_NEW)),
     mpStyleItem(),
@@ -589,38 +546,46 @@ void LinePropertyPanel::NotifyItemUpdate
         }
     	case SID_ATTR_LINE_START:
         {
-            const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState);
+		    mpFTArrow->Enable();
+		    mpLBStart->Enable();
 
-		    if(eState != SFX_ITEM_DONTCARE && pItem)
+		    if(eState != SFX_ITEM_DONTCARE)
 		    {
-			    mbStartAvailable = true;	//add 
-			    mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0);
-			    SelectEndStyle(true);
-		    }
-		    else
-		    {
-			    mpLBStart->SetNoSelection();
-			    mbStartAvailable = false;	//add 
+                const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState);
+
+                if(pItem)
+                {
+			        mbStartAvailable = true;	//add 
+			        mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0);
+			        SelectEndStyle(true);
+                    break;
+                }
 		    }
+
+            mpLBStart->SetNoSelection();
+			mbStartAvailable = false;	//add 
 		    break;
         }
     	case SID_ATTR_LINE_END:
         {
 		    mpFTArrow->Enable();
 		    mpLBEnd->Enable();
-            const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState);
 
-		    if(eState != SFX_ITEM_DONTCARE && pItem)
+		    if(eState != SFX_ITEM_DONTCARE)
 		    {
-			    mbEndAvailable = true;		//add 
-			    mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0);
-			    SelectEndStyle(false);		
+                const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState);
+
+                if(pItem)
+                {
+			        mbEndAvailable = true;		//add 
+			        mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0);
+			        SelectEndStyle(false);		
+                    break;
+                }
 		    }
-		    else
-		    {
-			    mpLBEnd->SetNoSelection();
-			    mbEndAvailable = false;		//add 
-		    }	
+
+            mpLBEnd->SetNoSelection();
+			mbEndAvailable = false;		//add 
 		    break;
         }
     	case SID_LINEEND_LIST:
@@ -1096,20 +1061,18 @@ void  LinePropertyPanel::FillLineEndList
 		SvxLineEndListItem aItem( *(const SvxLineEndListItem*)(pSh->GetItem( SID_LINEEND_LIST
) ) );		
 		mpLineEndList = aItem.GetLineEndList();
 		String sNone( SVX_RES( RID_SVXSTR_NONE ) );
-		//
 		mpLBStart->Clear();
 		mpLBEnd->Clear();
-		
+		mpLBStart->InsertEntry( sNone );
+		mpLBEnd->InsertEntry( sNone );
+
         if(mpLineEndList)
 		{
-			mpLBStart->InsertEntry( sNone );
-			mpLBStart->Fill( mpLineEndList );
-			mpLBStart->SelectEntryPos(0);
-
-			mpLBEnd->InsertEntry( sNone );
-			mpLBEnd->Fill( mpLineEndList, false);
-			mpLBEnd->SelectEntryPos(0);
+            FillLineEndListBox(*mpLBStart, *mpLBEnd, *mpLineEndList);
 		}
+
+		mpLBStart->SelectEntryPos(0);
+		mpLBEnd->SelectEntryPos(0);
 	}
 	else
 	{

Modified: openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.hxx?rev=1464066&r1=1464065&r2=1464066&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.hxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/line/LinePropertyPanel.hxx Wed Apr
 3 15:11:54 2013
@@ -44,7 +44,6 @@ class XLineStyleItem;
 class XLineDashItem;
 class XLineStartItem;
 class XLineEndItem;
-class LineEndLB_LPP;
 class XLineEndList;
 class ListBox;
 class ToolBox;
@@ -146,8 +145,8 @@ private:
     ::boost::scoped_ptr< FixedText >                        mpFTTrancparency;
     ::boost::scoped_ptr< MetricField >                      mpMFTransparent;
     ::boost::scoped_ptr< FixedText >                        mpFTArrow;
-    ::boost::scoped_ptr< LineEndLB_LPP >                    mpLBStart;
-    ::boost::scoped_ptr< LineEndLB_LPP >                    mpLBEnd;
+    ::boost::scoped_ptr< ListBox >                          mpLBStart;
+    ::boost::scoped_ptr< ListBox >                          mpLBEnd;
     ::boost::scoped_ptr< FixedText >                        mpFTEdgeStyle;
     ::boost::scoped_ptr< ListBox >                          mpLBEdgeStyle;
     ::boost::scoped_ptr< FixedText >                        mpFTCapStyle;

Modified: openoffice/branches/sidebar/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx?rev=1464066&r1=1464065&r2=1464066&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/possize/PosSizePropertyPanel.cxx Wed
Apr  3 15:11:54 2013
@@ -1090,7 +1090,9 @@ FieldUnit PosSizePropertyPanel::GetCurre
 	FieldUnit eUnit = FUNIT_NONE;
 
 	if ( pState && eState >= SFX_ITEM_DEFAULT )
+    {
 		eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue();
+    }
 	else
 	{
 		SfxViewFrame* pFrame = SfxViewFrame::Current();



Mime
View raw message