Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi all,

I have attached a first cut patch for the gradient fill for cells.
I initially tried using only the 'Gradient' tab from the area fill dialog - but it was too tightly tied to it. On the other hand probably we might want to include the other fill styles (and other tabs in the area dialog) for cells in calc too (?).

Pending issues (afaik):
1. Import/Export it to the ods format
2. Import/Export to xlsx format
3. Remove color tab from the format cell dialog
4. Implement 'no fill' option in area fill dialog
5. Testing: There could very well be bugs with this patch - I haven't
   done an extensive testing.
6. Minor (for documentation sake): Background color is set without
   testing if the user selected it or not. if(set) is required there.

I would be really nice if somebody (both from calc and ux team) could review this patch, please?

Thank you so much,
Muthu Subramanian

Attachment: gradient-fill.jpg
Description: JPEG image

diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index e65d314..00bb979 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1610,9 +1610,9 @@ AbstractGraphicFilterDialog * 
AbstractDialogFactory_Impl::CreateGraphicFilterMos
 AbstractSvxAreaTabDialog* AbstractDialogFactory_Impl::CreateSvxAreaTabDialog( Window* pParent,
                                                             const SfxItemSet* pAttr,
                                                             SdrModel* pModel,
-                                                            const SdrView* pSdrView )
+                                                            const SdrView* pSdrView, bool bIsSC )
 {
-    SvxAreaTabDialog* pDlg = new SvxAreaTabDialog( pParent, pAttr, pModel,pSdrView );
+    SvxAreaTabDialog* pDlg = new SvxAreaTabDialog( pParent, pAttr, pModel,pSdrView, bIsSC );
     return new AbstractSvxAreaTabDialog_Impl( pDlg );
 }
 
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 0a9c5be..e8b5a53 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -741,7 +741,7 @@ public:
     virtual AbstractSvxAreaTabDialog*       CreateSvxAreaTabDialog( Window* pParent,//add for 
SvxAreaTabDialog
                                                             const SfxItemSet* pAttr,
                                                             SdrModel* pModel,
-                                                            const SdrView* pSdrView = NULL ); 
//add for SvxAreaTabDialog
+                                                            const SdrView* pSdrView = NULL, bool 
bIsSC = false ); //add for SvxAreaTabDialog
     virtual SfxAbstractTabDialog*           CreateSvxLineTabDialog( Window* pParent, const 
SfxItemSet* pAttr, //add for SvxLineTabDialog
                                                                  SdrModel* pModel,
                                                                  const SdrObject* pObj = NULL,
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index b7f5fa6..52392aa 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -82,7 +82,7 @@ protected:
 public:
     SvxAreaTabDialog( Window* pParent,
                       const SfxItemSet* pAttr, SdrModel* pModel,
-                      const SdrView* pSdrView = NULL );
+                      const SdrView* pSdrView = NULL, bool bIsSC = false );
     ~SvxAreaTabDialog();
 
     void                SetNewColorList( XColorListRef pColTab )
diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx
index 6af90bf..1540324 100644
--- a/cui/source/tabpages/tabarea.cxx
+++ b/cui/source/tabpages/tabarea.cxx
@@ -52,7 +52,8 @@ SvxAreaTabDialog::SvxAreaTabDialog
     Window* pParent,
     const SfxItemSet* pAttr,
     SdrModel* pModel,
-    const SdrView* /* pSdrView */
+    const SdrView* /* pSdrView */,
+    bool bIsSC
 ) :
 
     SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_AREA ), pAttr ),
@@ -77,15 +78,26 @@ SvxAreaTabDialog::SvxAreaTabDialog
 {
     FreeResource();
 
-    AddTabPage( RID_SVXPAGE_AREA, SvxAreaTabPage::Create, 0 );
-    AddTabPage( RID_SVXPAGE_SHADOW, SvxShadowTabPage::Create, 0 );
-    AddTabPage( RID_SVXPAGE_TRANSPARENCE, SvxTransparenceTabPage::Create,  0);
     AddTabPage( RID_SVXPAGE_COLOR, SvxColorTabPage::Create, 0 );
     AddTabPage( RID_SVXPAGE_GRADIENT, SvxGradientTabPage::Create, 0 );
-    AddTabPage( RID_SVXPAGE_HATCH, SvxHatchTabPage::Create, 0 );
-    AddTabPage( RID_SVXPAGE_BITMAP, SvxBitmapTabPage::Create,  0);
+    if( !bIsSC )
+    {
+        AddTabPage( RID_SVXPAGE_AREA, SvxAreaTabPage::Create, 0 );
+        AddTabPage( RID_SVXPAGE_SHADOW, SvxShadowTabPage::Create, 0 );
+        AddTabPage( RID_SVXPAGE_TRANSPARENCE, SvxTransparenceTabPage::Create,  0);
+        AddTabPage( RID_SVXPAGE_HATCH, SvxHatchTabPage::Create, 0 );
+        AddTabPage( RID_SVXPAGE_BITMAP, SvxBitmapTabPage::Create,  0);
+    }
+    else
+    {
+        RemoveTabPage( RID_SVXPAGE_AREA );
+        RemoveTabPage( RID_SVXPAGE_SHADOW );
+        RemoveTabPage( RID_SVXPAGE_TRANSPARENCE );
+        RemoveTabPage( RID_SVXPAGE_HATCH );
+        RemoveTabPage( RID_SVXPAGE_BITMAP );
+    }
 
-    SetCurPageId( RID_SVXPAGE_AREA );
+    SetCurPageId( RID_SVXPAGE_COLOR );
 
     CancelButton& rBtnCancel = GetCancelButton();
     rBtnCancel.SetClickHdl( LINK( this, SvxAreaTabDialog, CancelHdlImpl ) );
diff --git a/editeng/inc/editeng/brshitem.hxx b/editeng/inc/editeng/brshitem.hxx
index b3c3140..29b74bd 100644
--- a/editeng/inc/editeng/brshitem.hxx
+++ b/editeng/inc/editeng/brshitem.hxx
@@ -40,6 +40,7 @@
 class Graphic;
 class GraphicObject;
 class CntWallpaperItem;
+class XGradient;
 namespace rtl
 {
     class OUString;
@@ -68,6 +69,7 @@ class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem
     String*             pStrFilter;
     SvxGraphicPosition  eGraphicPos;
     sal_Bool                bLoadAgain;
+    XGradient*          pGradient;
 
     void        ApplyGraphicTransparency_Impl();
     DECL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void *);
@@ -122,12 +124,14 @@ public:
     const GraphicObject*    GetGraphicObject() const;
     const String*           GetGraphicLink() const      { return pStrLink; }
     const String*           GetGraphicFilter() const    { return pStrFilter; }
+    const XGradient*        GetGradient() const         { return pGradient; }
 
     void                SetGraphicPos( SvxGraphicPosition eNew );
     void                SetGraphic( const Graphic& rNew );
     void                SetGraphicObject( const GraphicObject& rNewObj );
     void                SetGraphicLink( const String& rNew );
     void                SetGraphicFilter( const String& rNew );
+    void                SetGradient( const XGradient &aGradient );
 
     SvxBrushItem&       operator=( const SvxBrushItem& rItem);
 
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index dbf3943..a728401 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -85,6 +85,7 @@
 #include <editeng/unoprnms.hxx>
 #include <editeng/memberids.hrc>
 #include <editeng/editerr.hxx>
+#include <svx/xgrad.hxx>
 
 using namespace ::editeng;
 using namespace ::rtl;
@@ -3364,7 +3365,8 @@ SvxBrushItem::SvxBrushItem( sal_uInt16 _nWhich ) :
     pStrLink    ( NULL ),
     pStrFilter  ( NULL ),
     eGraphicPos ( GPOS_NONE ),
-    bLoadAgain  ( sal_True )
+    bLoadAgain  ( sal_True ),
+    pGradient   ( NULL )
 
 {
 }
@@ -3380,7 +3382,8 @@ SvxBrushItem::SvxBrushItem( const Color& rColor, sal_uInt16 _nWhich) :
     pStrLink    ( NULL ),
     pStrFilter  ( NULL ),
     eGraphicPos ( GPOS_NONE ),
-    bLoadAgain  ( sal_True )
+    bLoadAgain  ( sal_True ),
+    pGradient   ( NULL )
 
 {
 }
@@ -3397,7 +3400,8 @@ SvxBrushItem::SvxBrushItem( const Graphic& rGraphic, SvxGraphicPosition ePos,
     pStrLink    ( NULL ),
     pStrFilter  ( NULL ),
     eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
-    bLoadAgain  ( sal_True )
+    bLoadAgain  ( sal_True ),
+    pGradient   ( NULL )
 
 {
     DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
@@ -3415,7 +3419,8 @@ SvxBrushItem::SvxBrushItem( const GraphicObject& rGraphicObj,
     pStrLink    ( NULL ),
     pStrFilter  ( NULL ),
     eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
-    bLoadAgain  ( sal_True )
+    bLoadAgain  ( sal_True ),
+    pGradient   ( NULL )
 
 {
     DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
@@ -3434,7 +3439,8 @@ SvxBrushItem::SvxBrushItem(
     pStrLink    ( new String( rLink ) ),
     pStrFilter  ( new String( rFilter ) ),
     eGraphicPos ( ( GPOS_NONE != ePos ) ? ePos : GPOS_MM ),
-    bLoadAgain  ( sal_True )
+    bLoadAgain  ( sal_True ),
+    pGradient   ( NULL )
 
 {
     DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
@@ -3451,7 +3457,8 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
     pImpl       ( new SvxBrushItem_Impl( NULL ) ),
     pStrLink    ( NULL ),
     pStrFilter  ( NULL ),
-    eGraphicPos ( GPOS_NONE )
+    eGraphicPos ( GPOS_NONE ),
+    pGradient   ( NULL )
 
 {
     sal_Bool bTrans;
@@ -3567,20 +3574,31 @@ SvxBrushItem::SvxBrushItem( const SvxBrushItem& rItem ) :
     pStrLink    ( NULL ),
     pStrFilter  ( NULL ),
     eGraphicPos ( GPOS_NONE ),
-    bLoadAgain  ( sal_True )
+    bLoadAgain  ( sal_True ),
+    pGradient   ( NULL )
 
 {
     *this = rItem;
+    if( rItem.GetGradient() )
+        pGradient = new XGradient( *rItem.GetGradient() );
 }
 
 // -----------------------------------------------------------------------
 
+void SvxBrushItem::SetGradient( const XGradient& aGradient )
+{
+    delete pGradient;
+    pGradient = new XGradient( aGradient );
+}
+// -----------------------------------------------------------------------
+
 SvxBrushItem::~SvxBrushItem()
 {
     delete pImpl->pGraphicObject;
     delete pImpl;
     delete pStrLink;
     delete pStrFilter;
+    delete pGradient;
 }
 
 // -----------------------------------------------------------------------
@@ -3840,6 +3858,8 @@ SvxBrushItem& SvxBrushItem::operator=( const SvxBrushItem& rItem )
             pImpl->pGraphicObject = new GraphicObject( *rItem.pImpl->pGraphicObject );
         }
     }
+    if( rItem.pGradient )
+        pGradient = new XGradient( *rItem.pGradient );
     pImpl->nGraphicTransparency = rItem.pImpl->nGraphicTransparency;
     return *this;
 }
@@ -3880,6 +3900,10 @@ int SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
                              ( *pImpl->pGraphicObject == *rCmp.pImpl->pGraphicObject );
             }
         }
+        if( rCmp.pGradient && pGradient )
+            bEqual = bEqual && ( *rCmp.pGradient == *pGradient );
+        else
+            bEqual = bEqual && ( rCmp.pGradient == pGradient );
     }
 
     return bEqual;
@@ -4141,7 +4165,8 @@ SvxBrushItem::SvxBrushItem( const CntWallpaperItem& rItem, sal_uInt16 _nWhich 
)
     pImpl( new SvxBrushItem_Impl( 0 ) ),
     pStrLink(0),
     pStrFilter(0),
-    bLoadAgain( sal_True )
+    bLoadAgain( sal_True ),
+    pGradient   ( NULL )
 {
     aColor = rItem.GetColor();
 
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index be05859..1976969 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -972,6 +972,14 @@
                     <value xml:lang="en-US">Ce~lls...</value>
                 </prop>
             </node>
+            <node oor:name=".uno:FormatAreaDialog" oor:op="replace">
+                <prop oor:name="Label" oor:type="xs:string">
+                    <value xml:lang="en-US">Format A~rea...</value>
+                </prop>
+                <prop oor:name="ContextLabel" oor:type="xs:string">
+                    <value xml:lang="en-US">A~rea...</value>
+                </prop>
+            </node>
             <node oor:name=".uno:RowHeight" oor:op="replace">
                 <prop oor:name="Label" oor:type="xs:string">
                     <value xml:lang="en-US">Row ~Height...</value>
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 6f4befc..027556e 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -389,7 +389,7 @@
 #define FID_TAB_MENU_SET_TAB_BG_COLOR (TAB_POPUP_START + 9)
 #define FID_TAB_SET_TAB_BG_COLOR      (TAB_POPUP_START + 10)
 #define FID_TAB_EVENTS          (TAB_POPUP_START+11)
-
+#define SID_CELL_AREA           (TAB_POPUP_START + 12)
 #define TAB_POPUP_END           (TAB_POPUP_START + 20)
 
 #define OBJBAR_FORMAT_START     (TAB_POPUP_END)
diff --git a/sc/inc/sccommands.h b/sc/inc/sccommands.h
index 1350c0c..9355319 100644
--- a/sc/inc/sccommands.h
+++ b/sc/inc/sccommands.h
@@ -47,6 +47,7 @@
 #define CMD_SID_FILL_ADD_SUCC                       ".uno:FillModeTraceSuccessor"
 #define CMD_FID_FILL_SERIES                         ".uno:FillSeries"
 #define CMD_FID_CELL_FORMAT                         ".uno:FormatCellDialog"
+#define CMD_SID_CELL_AREA                           ".uno:FormatAreaDialog"
 #define CMD_SID_OPENDLG_SOLVE                       ".uno:GoalSeekDialog"
 #define CMD_SID_OPENDLG_OPTSOLVER                   ".uno:SolverDialog"
 #define CMD_FID_TABLE_HIDE                          ".uno:Hide"
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index f20b07c..5ed5b2b 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -94,6 +94,7 @@ interface CellSelection
     SID_MARKAREA            [ ExecMethod = Execute; ]
     SID_SELECT_SCENARIO     [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
     FID_CELL_FORMAT         [ ExecMethod = Execute; StateMethod = GetBlockState; ]
+    SID_CELL_AREA           [ ExecMethod = Execute; StateMethod = GetBlockState; ]
     SID_ENABLE_HYPHENATION  [ ExecMethod = Execute; StateMethod = GetBlockState; ]
     FID_ROW_HEIGHT          [ ExecMethod = Execute; StateMethod = GetState; ]
     FID_ROW_OPT_HEIGHT      [ ExecMethod = Execute; StateMethod = GetState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 050c645..eefd303 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -2673,6 +2673,30 @@ SfxVoidItem FormatCellDialog FID_CELL_FORMAT
 ]
 
 //--------------------------------------------------------------------------
+SfxVoidItem FormatAreaDialog SID_CELL_AREA
+()
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = TRUE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerItem;
+    Synchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_FORMAT;
+]
+//--------------------------------------------------------------------------
 SfxStringItem Formula SID_RANGE_FORMULA
 
 [
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 21ab63a..20eddf6 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -404,8 +404,11 @@ public:
 
     void    UpdateNumberFormatter   ( const SvxNumberInfoItem&  rInfoItem );
 
+    void    ExecuteCellAreaDlg      ( SfxRequest& rReq, sal_uInt16 nTabPage = 0xffff );
+
     void    ExecuteCellFormatDlg    ( SfxRequest& rReq, sal_uInt16 nTabPage = 0xffff );
 
+
     sal_Bool    GetFunction( String& rFuncStr, sal_uInt16 nErrCode = 0 );
 
     void    StartSimpleRefDialog( const String& rTitle, const String& rInitVal,
diff --git a/sc/source/ui/src/hdrcont.src b/sc/source/ui/src/hdrcont.src
index c541510..5217fd2 100644
--- a/sc/source/ui/src/hdrcont.src
+++ b/sc/source/ui/src/hdrcont.src
@@ -34,6 +34,12 @@
         Identifier = FID_CELL_FORMAT ; \
         HelpId = CMD_FID_CELL_FORMAT ; \
         Text [ en-US ] = "~Format Cells..." ; \
+    };\
+    MenuItem\
+    {\
+        Identifier = SID_CELL_AREA ; \
+        HelpId = CMD_SID_CELL_AREA ; \
+        Text [ en-US ] = "Format A~rea..." ; \
     };
 
 
diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src
index f0f85f1..79f9857 100644
--- a/sc/source/ui/src/popup.src
+++ b/sc/source/ui/src/popup.src
@@ -55,6 +55,12 @@ Menu RID_POPUP_CELLS
             HelpId = CMD_FID_CELL_FORMAT ;
             Text [ en-US ] = "~Format Cells..." ;
         };
+        MenuItem
+        {
+            Identifier = SID_CELL_AREA ;
+            HelpId = CMD_SID_CELL_AREA ;
+            Text [ en-US ] = "Format A~rea..." ;
+        };
          //------------------------------
         MenuItem { Separator = TRUE ; };
          //------------------------------
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 9c5a417..e394795 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -85,6 +85,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
                     // no break
 
             case FID_CELL_FORMAT:
+            case SID_CELL_AREA:
             case SID_ENABLE_HYPHENATION:
             case SID_DATA_SELECT:
             case SID_OPENDLG_CONSOLIDATE:
@@ -316,6 +317,13 @@ void ScCellShell::Execute( SfxRequest& rReq )
             }
             break;
 
+        case SID_CELL_AREA:
+            {
+                if( pReqArgs == NULL )
+                    pTabViewShell->ExecuteCellAreaDlg( rReq );
+            }
+            break;
+
         case FID_CELL_FORMAT:
             {
                 if ( pReqArgs != NULL )
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index aac7fde..0a32370 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -763,6 +764,12 @@ sal_Bool lcl_EqualBack( const RowInfo& rFirst, const RowInfo& rOther,
     {
         const Color* pCol1 = rFirst.pCellInfo[nX+1].pColorScale;
         const Color* pCol2 = rOther.pCellInfo[nX+1].pColorScale;
+        const XGradient*    pGrad1 = rFirst.pCellInfo[nX+1].pBackground->GetGradient();
+        const XGradient*    pGrad2 = rOther.pCellInfo[nX+1].pBackground->GetGradient();
+
+        if( pGrad1 || pGrad2 )
+            return false;
+
         if( (pCol1 && !pCol2) || (!pCol1 && pCol2) )
             return false;
 
@@ -889,17 +896,25 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const 
Color
         rRect.Left() = nPosX - nSignedOneX;
     }
 
-    if ( pOldBackground && (pColor ||pBackground != pOldBackground || pOldDataBarInfo || 
pDataBarInfo) )
+    if ( pOldBackground && (pColor || pBackground != pOldBackground || pOldDataBarInfo || 
pDataBarInfo || pOldBackground->GetGradient() ) )
     {
         rRect.Right() = nPosX-nSignedOneX;
         if (pOldBackground)             // ==0 if hidden
         {
             Color aBackCol = pOldBackground->GetColor();
-            if ( !aBackCol.GetTransparency() )      //! partial transparency?
+            const XGradient *pGradient = pOldBackground->GetGradient();
+            if( pGradient )                             // Background is a gradient
+            {
+                Gradient aGrad( (GradientStyle)pGradient->GetGradientStyle(), 
pGradient->GetStartColor(), pGradient->GetEndColor() );
+                aGrad.SetAngle( pGradient->GetAngle() );
+                pDev->DrawGradient( rRect, aGrad );
+            }
+            else if ( !aBackCol.GetTransparency() )      //! partial transparency?
             {
                 pDev->SetFillColor( aBackCol );
                 pDev->DrawRect( rRect );
             }
+
         }
         if( pOldDataBarInfo )
             drawDataBars( pOldDataBarInfo, pDev, rRect );
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 4deb025..a7d3b5c 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -39,6 +39,11 @@
 #include <sfx2/dispatch.hxx>
 #include <sfx2/request.hxx>
 #include <vcl/msgbox.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xflgrit.hxx>
+#include <editeng/brshitem.hxx>
 
 #include "global.hxx"
 #include "attrib.hxx"
@@ -59,6 +64,8 @@
 #include "scabstdlg.hxx"
 #include "compiler.hxx"
 #include "markdata.hxx"
+#include "drawview.hxx"
+#include "drwlayer.hxx"
 
 
 sal_Bool ScTabViewShell::GetFunction( String& rFuncStr, sal_uInt16 nErrCode )
@@ -475,6 +482,55 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
 }
 
 //------------------------------------------------------------------
+void ScTabViewShell::ExecuteCellAreaDlg( SfxRequest& rReq, sal_uInt16 nTabPage )
+{
+    SfxAbstractTabDialog    *pDlg           = NULL;
+    ScViewData              *pViewData      = GetViewData();
+    const ScPatternAttr     *pOldAttrs      = GetSelectionPattern();
+    ScDrawView              *pView          = pViewData->GetScDrawView();
+    sal_Bool                bHasMarked      = pView->AreObjectsMarked();
+    SfxItemSet              aNewAttr( pView->GetDefaultAttr() );
+    if( bHasMarked )
+        pView->MergeAttrFromMarked( aNewAttr, false );
+    SfxItemSet              *pOldSet        = new SfxItemSet(
+                                                    pOldAttrs->GetItemSet() );
+    SfxItemSet              *pNewSet        = new SfxItemSet( *pOldSet );
+
+    aNewAttr.ClearItem( XATTR_FILLCOLOR );
+    aNewAttr.Put( XFillColorItem( String(), (( SvxBrushItem *)&pNewSet->Get( ATTR_BACKGROUND 
))->GetColor() ) );
+
+    //ScAbstractDialogFactory *pFact          = ScAbstractDialogFactory::Create();
+    SvxAbstractDialogFactory  *pFact        = SvxAbstractDialogFactory::Create();
+    OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
+    pDlg = pFact->CreateSvxAreaTabDialog(
+                                        pViewData->GetDialogParent(), &aNewAttr,
+                                        pViewData->GetDocument()->GetDrawLayer(), pView, true);
+    if ( nTabPage != 0xffff )
+        pDlg->SetCurPageId( nTabPage );
+
+    short nResult = pDlg->Execute();
+    if ( nResult == RET_OK )
+    {
+        const SfxItemSet          *pOutSet      = pDlg->GetOutputItemSet();
+        const XFillColorItem*     pXColor       = (const XFillColorItem*)     &pOutSet->Get( 
XATTR_FILLCOLOR );
+        SvxBrushItem aBrush( pXColor->GetColorValue(), ATTR_BACKGROUND );
+        if( pOutSet->GetItemState( XATTR_FILLGRADIENT ) == SFX_ITEM_SET )
+        {
+            const XGradient&          aXGradient    = ((const XFillGradientItem *)&pOutSet->Get( 
XATTR_FILLGRADIENT ))->GetGradientValue();
+            aBrush.SetGradient( aXGradient );
+        }
+        pNewSet->ClearItem( ATTR_BACKGROUND );
+        pNewSet->Put( aBrush );
+
+        ApplyAttributes( pNewSet, pOldSet );
+        
+        rReq.Done( *pNewSet );
+    }
+
+    delete pOldSet;
+    delete pDlg;
+}
+//------------------------------------------------------------------
 void ScTabViewShell::ExecuteCellFormatDlg( SfxRequest& rReq, sal_uInt16 nTabPage )
 {
     SfxAbstractTabDialog * pDlg = NULL;
diff --git a/svx/inc/svx/svxdlg.hxx b/svx/inc/svx/svxdlg.hxx
index de5fc03..9c77d14 100644
--- a/svx/inc/svx/svxdlg.hxx
+++ b/svx/inc/svx/svxdlg.hxx
@@ -453,7 +453,7 @@ public:
     virtual AbstractSvxAreaTabDialog*       CreateSvxAreaTabDialog( Window* pParent,//add for 
SvxAreaTabDialog
                                                             const SfxItemSet* pAttr,
                                                             SdrModel* pModel,
-                                                            const SdrView* pSdrView = NULL ) = 0 ;
+                                                            const SdrView* pSdrView = NULL, bool 
bIsSC = false ) = 0 ;
     virtual SfxAbstractTabDialog*           CreateSvxLineTabDialog( Window* pParent, const 
SfxItemSet* pAttr, //add forSvxLineTabDialog
                                                                  SdrModel* pModel,
                                                                  const SdrObject* pObj = NULL,
diff --git a/svx/inc/svx/tabarea.hxx b/svx/inc/svx/tabarea.hxx
index 6563e1b..dbad692 100644
--- a/svx/inc/svx/tabarea.hxx
+++ b/svx/inc/svx/tabarea.hxx
@@ -25,6 +25,10 @@
  * for a copy of the LGPLv3 License.
  *
  ************************************************************************/
+#include "dlgctrl.hxx"
+#include "xfillit0.hxx"
+#include "xflgrit.hxx"
+
 #ifndef _SVX_TAB_AREA_HXX
 #define _SVX_TAB_AREA_HXX
 
diff --git a/svx/inc/svx/xgrad.hxx b/svx/inc/svx/xgrad.hxx
index 0b2c972..7c3bbfd 100644
--- a/svx/inc/svx/xgrad.hxx
+++ b/svx/inc/svx/xgrad.hxx
@@ -50,7 +50,18 @@ public:
                sal_uInt16 nStartIntens = 100, sal_uInt16 nEndIntens = 100,
                sal_uInt16 nSteps = 0 );
 
-    bool operator==(const XGradient& rGradient) const;
+    bool operator==(const XGradient& rGradient) const {
+        return ( eStyle         == rGradient.eStyle         &&
+             aStartColor    == rGradient.aStartColor    &&
+             aEndColor      == rGradient.aEndColor      &&
+             nAngle         == rGradient.nAngle         &&
+             nBorder        == rGradient.nBorder        &&
+             nOfsX          == rGradient.nOfsX          &&
+             nOfsY          == rGradient.nOfsY          &&
+             nIntensStart   == rGradient.nIntensStart   &&
+             nIntensEnd     == rGradient.nIntensEnd     &&
+             nStepCount     == rGradient.nStepCount );
+    }
 
     void SetGradientStyle(XGradientStyle eNewStyle) { eStyle = eNewStyle; }
     void SetStartColor(const Color& rColor)         { aStartColor = rColor; }
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 24b037f..fb2935c 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -3114,27 +3114,6 @@ XGradient::XGradient(const Color& rStart, const Color& rEnd,
 {
 }
 
-/*************************************************************************
-|*
-|*    int XGradient::operator==(const SfxPoolItem& rItem) const
-|*
-*************************************************************************/
-
-bool XGradient::operator==(const XGradient& rGradient) const
-{
-    return ( eStyle         == rGradient.eStyle         &&
-             aStartColor    == rGradient.aStartColor    &&
-             aEndColor      == rGradient.aEndColor      &&
-             nAngle         == rGradient.nAngle         &&
-             nBorder        == rGradient.nBorder        &&
-             nOfsX          == rGradient.nOfsX          &&
-             nOfsY          == rGradient.nOfsY          &&
-             nIntensStart   == rGradient.nIntensStart   &&
-             nIntensEnd     == rGradient.nIntensEnd     &&
-             nStepCount     == rGradient.nStepCount );
-}
-
-
 // -----------------------
 // class XFillGradientItem
 // -----------------------

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.